errors installing npm packages - node.js

I am new to node.js and trying to install some packages like express and jade but its getting me frustrated, every time I am encountering different kind of errors some of which are
ENOENT
EADDRINFO
Could not load package.json
I have also googled it but nothing helped me, I am on a wi-fi network provided by our college(cyberoam) and tor-deamon is installed on my linux machine. Any good tutorials to install npm packages properly will be appreciated. Thank you in advance.

Try executing following commands on your command prompt, by replacing proxy address:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

Related

Not able to install cypress on windows 10

Above is the attached picture of the problem I got. I have installed Nodejs and run npm install command to create a package.json file in the cypress folder but was still not able to install it.
Try this
npm config set registry http://registry.npmjs.org/
so that npm requests for http url instead of https.
and then try the same npm install command
clear your cache by doing npm cache clean.
NOTE can lead to a security problem since https is not used here. I don't recommend to use this on production.
If the above mentioned doesn't work:-
1)ping registry.npmjs.org
2)I was able to solve this by running the following command:
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxy
If this method did not work, disabling your router's firewall would solve the issue immediately.
ETIMEDOUT Error while installing Node packages on Windows
Please follow the below steps to fix,
npm config set proxy false
npm cache clean --force
npm install cypress
Hope it will fix your installation issue.
I'm also finding the npm install cypress command to be not working.
A workaround is to use npm install cypress#4.0.1.

Infinite loading bar when run npm install

I am completely new to topic of Node to be honest, but I can't find the answer for my question. I have Ubuntu 18.04 on my WSL, and want to install some tool called jscpd on my WSL. I have already done apt-get update and installed npm packages etc. To install jscpd, I use npm install -g jscpd and this causes showing some loading bar which never ends. Installing another things also does not work. Can you tell me whan can be a problem in it?
Okay, after some time I found the answer - essential was that I am behind company's proxy, and npm does not take info from .bashrc about proxy settings, so you have to set them independently by
npm config set http-proxy http://proxy_host:port
npm config set https-proxy http://proxy_host:port -> yes, as a https you should write http, not https, this is not figured out why.

NPM throws error unable_to_get_issuer_cert_locally while installing any package behind corporate firewall

1.I downloaded node ( latest v4.6.0)
Set proxy path FOR npm
tried npm install
I got the error ---
UNABLE_TO_GET_ISSUER_CERT_LOCALLY
I could not get any help from google(people said downgrade to v0.x) but a colleague helped ..
npm set strict-ssl=false
This helped ...
I am posting this question and answer for helping people who come across the same error
Please try using this command:
npm config set registry http://registry.npmjs.org/
On top of above cacert.pem made ready, you need to do the below to install without errors.
`npm config set strict-ssl=false
npm config set registry http://registry.npmjs.org/
npm config set cafile /path/to/your/cert.pem
set NODE_TLS_REJECT_UNAUTHORIZED=0`
Got to resolve this in VM with firewall protection. With Zscaler, if issues exists, please update policy in it and rerun the above.

Node.js npm install ETIMEDOUT

I am trying to run a demo program.
As per the instruction I have to run the command npm install, which install all the dependencies but facing the problem as below
Try the following command, it changes the registry's protocol from https to http.
npm config set registry http://registry.npmjs.org/
Please try
npm config set proxy null
It worked for me on date I posted this.

locally installing node npm packages

I am accessing internet under the wifi network(cyberoam) provided by our college. Whenever I am trying to install any npm package I am getting error like:
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
ECONNREFUSED
I haven't set up any proxies on my Linux machine then also I'm getting error like this.
Is there any way to install those packages locally i.e how can I use them directly without installing them as npm packages.
Yes it is possible but I usually don't do that. For a quick and dirty solution:
Search for the packages repos in github
Checkout them to your local machine
And copy each one to the ./node_modules directory inside your node.js application folder.
In the future I certainly recommend you to use npm instead.

Resources