npm install -g <package> error EADDRINUSE - node.js

I have been trying to install jshint through npm that is required for SublimeLinter-jshint.
I am running windows 7 (64bit). It seems to keep failing with the error message:
`C:\Users\Ephekz>npm install -g jshint
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files (
x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "jshint"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code EADDRINUSE
npm ERR! errno EADDRINUSE
npm ERR! syscall connect
npm ERR! connect EADDRINUSE
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Ephekz\npm-debug.log`
I have tried this so far:
disabling AVG antivirus
disabling windows Firewall
checking if port 443 is in use by another service using netstat -aon : findstr:443. (nothing is listening in on that port)
tried different versions of nodejs v.5.6.0, v.4.3.0, v.0.1.24
tried multiple internet connections, also tried internet connection with no router
tried "npm cache clean"
tried "npm config set registry https://registry.npmjs.org/" and also "npm config set registry http://registry.npmjs.org/"
I have tried installing a different package (bower) which was successful.
I am not running through a proxy
I am not really sure what to do from here to make this work. Any suggestions would be greatly appreciated. I have attached a link to the debug log below:
https://github.com/npm/npm/files/133529/npm-debug.txt

In case anyone is experiencing a similar issue, I was able to resolve this issue by reinstalling the driver for my network adapter.

Related

node-gyp rebuild fails on Mac OS High Sierra while npm install

I am getting following error in the terminal, while it tries to install one of package "node-expat". I have tried switching to different node version using nvm but still it is failing with same error.
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/node-expat
npm ERR! node v6.5.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! node-expat#2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat#2.0.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-expat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\<redacted>\npm-debug.log
I went ahead installing x-code as suggested on git hub page, on my machine and then it is giving following error,. Not sure how to debug further.
xcode-select: error: tool 'xcodebuild' requires Xcode,
but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
I just got it fixed on my machine and my fellow colleagues machine.
Followed the following steps to fix it on MacOS highSierra 10.13:
Downloaded command line tools (MacOS 10.13) for xcode and installed it.
Download it from "https://developer.apple.com/download/more/"
Installed xcode 10.0 from the app store. Opened xcode and went through the regular configuration xcode does in the initial start up.
After this it started giving "xcode-select" path issue as stated in the description above. On running command "xcode-select --print-path" it was showing path as '/ Library/Developer/CommandLineTools', so i went ahead and tried "xcode-select --reset" after which the path changed to "/Applications/Xcode.app/Contents/Developer".
Immediately after it the build started working without any issues.
Solution above mentioned by Luke worked partially for me (MacOS) but created another issue :
gyp ERR! stack Error:makefailed with exit code: 2 which was solved by removing locked json file. Issue was created due to permission in MAC OS. So if you have xcode re-installed already, open terminal (command line) and type:
xcode-select --reset
then go to your project folder and remove:
package-lock.json
Now in terminal reinstall project :
npm install
I hope this helps someone!

How to install node packages in ubuntu server with IPv6 only

I'm trying to install typescript on an Ubuntu server where only IPv6 address space is available.
I'm getting error as follows. Any help?
:/home/dev/.nvm# npm install --global typescript
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/typescript failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-11-01T19_15_39_294Z-debug.log
The error of this network connectivity happens with many packages and even github. I installed nvm in a slightly different way by setting the codebase in bitbucket.
I tried to install npm and n to setup typescript using n. That failed and I started using nvm as alternative. PFB the logs when trying to install n.
:~# sudo npm install -g n
npm ERR! Linux 4.4.0-98-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "n"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ENETUNREACH
npm ERR! errno ENETUNREACH
npm ERR! syscall connect
npm ERR! connect ENETUNREACH ::ffff:151.101.208.162:80 - Local (:::0)
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
I just need some way to get it installed but no luck! I strongly believe it is IPv6 issue and looking for work around.
Btw, my ubuuntu server is 16.04.3 LTS. I have installed it successfully on IPv4 servers running on Ubuntu 16.10 and 17.04 version and here in Production, I'm locked!
I got that working after a change in registry. Could be a network problem that I faced on server OR the IPv6 only issue. Anyway the change in registry worked perfect.
sudo npm --registry http://registry.node-modules.io/ install n -g
After all the link below guided me to the answer.
Node-modules.io
Hope this will help somebody for the future reference!
Thanks for #Kalana Demel for the help to reach me to the answer.
Another workaround which will also work for yarn, is to add the resolved ip6s to /etc/hosts :
2606:4700::6810:1723 registry.yarnpkg.com
2606:4700::6810:1723 registry.npmjs.org
2606:4700::6810:ab63 yarnpkg.com
You can get the ip6s with nslookup registry.yarnpkg.com, nslookup ….
It seems the issue might be with proxy setting try using http instead of https, ipv6 issues seems to be resolved in the newer versions of npm as well.
npm config set registry http://registry.npmjs.org/
npm cache clean
Update
It seems that the issue which was supposed to be fixed in 8.5.0 is still there, so for IPV6 only networks npm is still not working even though Node is now passing the necessary flags, so till it's fixed you will have to find a workaround.
For more info : Node, NPM

npm ERR! Cannot read property 'path' of null

**C:\Users\Abc>npm install -g
npm ERR! addLocal Could not install C:\Users\Abc
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe"
"C:\Users\Abc\AppData\Ro
aming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g"
npm ERR! node v7.2.1
npm ERR! npm v4.0.5
npm ERR! Cannot read property 'path' of null
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Abc\npm-debug.log**
i have reinstall node with version 7.2.1
after every time this occurs when i download any package
need suggestion related to null path error
I ran into this issue while installing gulp
My NPM and Node Versions are:
node v7.7.4
npm v4.1.2
In npm version 4x, https client certificates were made required rather than optional. Details are in their github area.
Long story short, what helped for me was running the following command:
npm config set strict-ssl false
Once this was done, running the command
npm install gulp -g
Worked like a charm for me!
If you are working behind proxy, you need to set proxy for nodejs
npm config set proxy http://proxy_host:port
npm config set https-proxy http://proxy_host:port
Hope it Helps.. :)
npm install command is used to install packages.
Reason for your error :
You don't have any package.json in your current working directory.
Also, you didn't provide any package name to install from.
Tips :
Check out https://docs.npmjs.com/cli/install for more details.
Never use -g (install dependency globally unless you intend to).

Angular2 Quickstart lite-server crashes

Good Morning people from the Internet,
Intro
While following the Angular2 Quickstart guide I have experienced many times issues where lite-server would crash just after executing npm start. Crash would look like this in your terminal:
ERR! Linux 3.19.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "lite"
npm ERR! node v5.7.0
npm ERR! npm
v3.8.2
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart#1.0.0 lite: `lite-server`
npm ERR!
Exit status 1
npm ERR!
npm ERR! Failed at the angular2-quickstart#1.0.0 lite script 'lite-server'.
npm
ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR!
Tell the author that this fails on your system:
npm ERR! lite-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/oscar/dev/cw/npm-debug.log
Most common reasons (and solutions)
Most of the time the reason was one of the two:
lite-server was not shutdown properly. Solution: Killing all npm / node instances and restarting the server with npm start would do the trick.
dependencies are not up to date. Solution: simply deleting the node_modules directory, executing npm install to rebuild the dependencies would do the trick.
Other issue
However when reaching the step called 6.Routing the issue was a bit different. This time instead of crashing straightaway it was failing after typescript compilation:
16.03.15 16:33:49 200 GET /index.html
events.js:154
throw er; // Unhandled 'error' event
^
Error: watch node_modules/angular2/es6/prod/examples/platform/dom/debug/ts/debug_element_view_listener ENOSPC
at exports._errnoException (util.js:856:11)
...
at FSReqWrap.oncomplete (fs.js:82:15)
I have found the cause of the crash. And I felt like sharing the path so it might help others because there are many forum / stackoverflow threads around the same sort of issue but none solved this crash.
Basically, I looked at the stack trace to find which "module" was failing. Here it is
at FSReqWrap.oncomplete (fs.js:82:15)
and the solution was to execute the following command (see this ticket):
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
but instead of just executing it, I needed to understand why setting to 524288 the config item fs.inotify.max_user_watches into /etc/sysctl.conf which is after a system file. I found the answer here where it says and I quote:
Nodejs would report an error if there's too many files for watching due to system limitation, on Linux you can change that by adding fs.inotify.max_user_watches = 524288 to the file etc/sysctl.conf and restart the process
Hope it helps.

npm install not working

I just started learning node.js and i have installed node.js along with npm module manager.
I have created a package.json file and from the root directory iam trying to execute npm install command, instead of creating npm_modules folder it throws error like this:
C:\Users\username\Desktop\nodetest>npm install
npm WARN package.json backbone-library#0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/mongoose
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/path
npm http GET https://registry.npmjs.org/path
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/mongoose
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/path
npm http GET https://registry.npmjs.org/mongoose
npm ERR! Error: connect ETIMEDOUT
npm ERR! at errnoException (net.js:863:11)
npm ERR! at Object.afterConnect [as oncomplete] (net.js:854:19)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "D:\\Program Files\\nodejs\\\\node.exe" "D:\\Program Files\\no
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\username\Desktop\nodetest
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! syscall connect
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\username\Desktop\nodetest\npm-debug.log
npm ERR! not ok code 0
Iam using Windows 7 OS.
Any ideas ?
Thanks,
Srinivas
This will probably solve your problem:
npm config set proxy proxy-url:port (http:\\proxy-name:port)
npm config set https-proxy proxy-url:port
It was a stuck step on my side,
the following syntax worked for me:
npm config set proxy http:/myproxyserver:port
best regards :)
You may need to use the windows "run as" command (which is equivalent to the *nix "sudo" command) in order to have the correct privileges on your machine.
This link should be helpful: https://superuser.com/questions/42537/is-there-any-sudo-command-for-windows
finally i came to know that my company laptop has proxy restrictions.Once i got the approval for proxy removal it worked.
But still ppl, who ever facing proxy issue in npm install,can try the following method.
Go to C:\Users\YourUserName
Create a file named .npmrc (no need of any prefixname just .npmrc)
Inside that file type the following
proxy = username:password#ip:port (add http:// before username)
That's all.It is perfectly working for me....
The traceroute command will usually tell you where a connection fails and would have lead you straight to the corporate proxy in this case.
Adding to the selected answer
a) "npm config set proxy proxy-url:port (http:\proxy-name:port)
b) npm config set https-proxy proxy-url:port"
make sure you add "http:\\" to your proxy name, and packages downloaded from npm use ssl so try the second option for sure.
If you are working behind a proxy, configure it:
npm config set proxy http://login:pass#host:port
Check the value of your proxy configuration:
npm config get http-proxy
Try again to get your package...

Resources