[Error: Invalid protocol: null] in http request


(Eldhoseelias) #1

In my project I tried to update mongoose.
I directly change my mongoose version in package.json.
And run npm install.
I got the result some package updated and some packages removeed.
Now I tried to run my project.
In my project I’m using npm request to make API calls.
While making a request , it’s show an error
Protocol undefined null.

How to fix this issue.

request('http://x.x.xxx.xx:8000/names'
, function(err, res, body){
    if(err == null){
        res.status(200).send(data);
    }else{
        console.log(err);
    }});

(Lars Willighagen) #2

request is not by npm, it’s only distributed on the npm registry (together with almost a million other packages). Topics in #support and #bugs should be about npm itself: the registry, the website, and mainly the CLI. Since this error doesn’t seem to be caused by any of those, I moved it to #community:javascript for you.