Infinite loading bar when run npm install - node.js

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.

Related

npm install always ETIMEOUT can's fix

I have spent my whole day on fixing this problem but can't see any light.
My node and npm version is below
And no matter what package I wanna install, it always show
I am sure that I am not in any proxy and I have already lower my node version from 18 to 14,
but the problem still exist!!!!
Could anyone know how to fix this problem help me?
I already tried every way to fix this but can't work.
Since when did the issue start? Did it occur after you installed any dependency or made any proxy / firewall related configurations?
However you can try one of the following ways to fix this issue
Delete node_modules folder and in terminal, write
npm install
Change your nodejs version, either upgrade it or downgrade it
Reinstall nodejs
Try some other package manager like yarn
Note: When changing your nodejs version, please ensure that your node version is compitable with the npm version
Edit:
If these solutions don't work, the error is most probably caused by network related issues, you can try the following fixes
In terminal, reset the registry path of your node package manager
npm config set registry http://registry.npmjs.org/
If you are using your organization's computer, you need to use a proxy, remember to change the proxy url and port as per your organization
npm config set proxy http://proxyurl.com:8080
npm config set https-proxy http://proxyurl.com:8080
Instead of local installation, try installing packages globally i.e
npm install -g mongoose
Clear the cache
npm cache verify
Switch your device to some other wifi network and then try installing some npm packages

NPM - Can't install packages

I inherited a React project and after getting the latest code it failed to run - the previous developer isn't available. So, with no experience, I got on with it
Here's a list of the thing I did:
Updated Node to latest
Updated NPM to latest
Updated VS Code to latest
Removed package-lock.json
Ran a bunch of npm<whatever> commands that are littered all over internet
The coup de grĂ¢ce was when I deleted all the packages from node_modules
So, now I can't even get npm install --verbose to work. It just hangs and gives no feedback. I can't reinstall Node because the jokers here got us locked-down.
What can I do to install the packages? Am I doomed?
UPDATE: I disconnected from the network and went on the company wifi and npm install worked. How can that be?
Due to your update - probably your machine is behind the company proxy, that's why npm cannot get packages. To fix this find your proxy address, and after this run in terminal:
npm config set proxy http://yourproxy.company.com:8080
npm config set https-proxy http://yourproxy.company.com:8080
I found this method on https://jjasonclark.com/how-to-setup-node-behind-web-proxy/, works very good.

Npm install just spinning on Ubuntu

I can't successfully install anything with npm now it seems on my Ubuntu 15.04.
npm install -g gulp
/
Just spinns for ever and nothing happens, tried with sudo and without..
nodejs -v
v0.12.4
and
npm -v
2.10.1
I have tried
*Reinstall nodejs
*Clearing the cahce globally and locally.
*Removing nodejs manually
*Tried installing different npm packages (Gulp, browserfiy ..etc)
*Chainging the ownership of ~/.npm recursivly to me instead of root
But nothing gives, I feel the only thing left for me to do is reinstall ubuntu..
Do you have any suggestions? All help is appreciated!
This seems like a problem with your internet connection. Two possible reasons that I can think of are,
1) Connecting to the internet through a proxy server.
Then you will have to configure proxy for the npm. You can do this by adding HTTP_PROXY, HTTPS_PROXY environment variables to a value like http://proxy.company.com:8080 or when you are installing modules using this command.
npm --https-proxy=http://proxy.company.com:8080 -g install gulp
2) You don't use a proxy, but proxy setting are enabled in your computer.
If you don't use a proxy but if you have set up HTTP_PROXY, HTTPS_PROXY environment variables, npm will not be able to download the module because it automatically uses these settings. So remove those environment variables and try again.
If you use -d flag, you can see the details of the download.
npm install -g -d gulp
Hope this is helpful.
References: Using Npm Behind a Corporate Proxy
My suggestion is to develop everything using ubuntu 14.04. A lot of virtual server providers only let you use 14.04 if you choose ubuntu (such as Digitalocean). Also a lot of service providers (such as Docker and many others) use ubuntu 14.04 as their standard base ubuntu image for you to develop your services. And it will be much easier for you to code, test, ship in the same environment just like others do.

After completely uninstalling nodejs when I run npm config ls command, I can still see proxy I set earlier

I am not able to install packages using npm. I keep getting error shown in below image.
Using link1, link2, link3 I uninstalled nodejs. After installing the nodejs again, when I run npm config ls command, I can still see proxy details which I added earlier.
How can I ensure that when I uninstall nodejs it also removes all the config files.
I was setting proxy as
npm config set http_proxy=http://myproxy address:8080
which is wrong now I use
npm config set proxy http://myproxy address:8080
and I am able to install packages.

NPM does not install anything : it hangs

Whenever I want to install a module with NPM, it hangs at that stage:
npm install express
npm http GET https://registry.npmjs.org/express
And that's it. It has that behavior for anything I input instead of express. I installed nodejs and nvm that way (Ubuntu 13.10):
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
I tried looking on the Internet and GitHub and I found a closed issue about npm hanging forever when trying to install a module.. but it was a really old issue. Before I ask the developers, am I missing something obvious ?
I tried compiling both nodejs and npm but the result was the same.
EDIT: npm install express -verbose -> http://pastebin.com/tGY3V6Ly
Error:
npm info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=140072708810560:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:766:
NPM has been having server issues of late. Try running the command with -verbose to check and see what is going on, and be patient.
It is likely of proxy problem. I didn't set proxy but somewhow this worked for me
npm config delete proxy
npm config delete https-proxy
npm set registry https://registry.npmjs.org/
I had this issue on a BeagleBone Black (low power ARM device) and running npm cache clean seemed to get things moving again.
Try without https:
npm config set registry http://registry.npmjs.org/
I had the same issue and I solved by disabling all my firewalls
After an hour of struggling, I cleaned .npm and node_modesl/.staging directories, and problem just gone!
(replace the paths with your own)
yes|rm /root/.npm/* -R
yes|rm /path/to/node_modules/.staging/* -R
npm install
For me, this is what worked:
npm cache clean
And then I reloaded the terminal window and ran npm install again.
I opened console with admin privileges and the ran npm install on windows. My problem was fixed with this
I had the same error and the problem was in proxy: previously I set up HTTP_PROXY environment variable and after removing it npm install completed without any error.
I had this problem inside a Windows git bash terminal - reinstalling the latest version of git bash fixed it
I was using an older version of node. I used a newer version
Type in Terminal:
nvm use stable
and then
npm i
and all worked just fine.
Just found out that the "Killer network suite" was why this wasn't working.
I don't know why but it was throttling connection to the server.

Resources