Inconsistent behavior while installing npm module - node.js

I am installing a npm module which use cmake-js inside it. (I mentioned cmake-js just for the information). I am behind a corporate proxy. (I have set proxy settings property). I have already set following configurations.
npm config set proxy http://xxxx:yyyy
npm config set https-proxy http://xxxx:yyyy
npm config set registry=https://registry.npmjs.org/
npm config set strict-ssl false
My npm version is 6.4.1. I can build the module without any problem when I switch to node version 8.10.0 using sudo n 8.10.0.
But when I move to node 8.0.0 version, I am getting the following error.
> cmake-js compile
info TOOL Using Unix Makefiles generator.
info TOOL Using c++11 compiler standard.
info DIST Downloading distribution files.
http DIST - https://nodejs.org/dist/v8.0.0/SHASUMS256.txt
ERR! OMG tunneling socket could not be established, cause=read ECONNRESET
ERR! OMG tunneling socket could not be established, cause=read ECONNRESET
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ur-node#1.0.0 install: `cmake-js compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ur-node#1.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/malintha/.npm/_logs/2018-09-17T14_23_42_781Z-debug.log
It seems like proxy issue, but it is working fine with node 8.10.0
What is the possible reason for this issue? Appreciate any insight to solve this issue.

Related

Error occurs when running npm install after creating VueJS project

I just installed VueJS and I tried creating a project. I followed their installation and quick start guide VueJS Getting Started.
> npm init vue#latest
> cd (My Project Name Here)
> npm install
However, after doing > npm install, it returns the following message in the VSCode Terminal:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/lodash: Socket timeout
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! C:\Users\alscg\AppData\Local\npm-cache\_logs\2022-04-07T08_54_47_537Z-debug-0.log
How do I fix this? Am I doing this wrong?
Please try this link it looks like it is answered already
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)

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).

‘node-gyp rebuild’ installation error when adding a package to meteor app in Windows 7

I was trying to add a package (mizzao:turkserver) to my Meteor application, but I kept getting this error:
mizzao:turkserver: updating npm dependencies -- request, libxmljs,
validator, querystring, async, deepmerge...
gypnpm ERR! Windows_NT 6.1.7601
npm ERR! argv
"C:\\Users\\PC4all\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os
.windows.x86_32\\dev_bundle\\bin\\\\node.exe"
"C:\\Users\\PC4all\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os
.windows.x86_32\\dev_bundle\\bin\\node_modules\\npm\\bin\\npm-cli.js"
"install" "libxmljs#0.8.1"
npm ERR! node v0.10.36
npm ERR! npm v2.7.3
npm ERR! code ELIFECYCLE
npm ERR! libxmljs#0.8.1 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the libxmljs#0.8.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the libxmljs 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 their info via:
npm ERR! npm owner ls libxmljs
npm ERR! There is likely additional logging output above.
=> Babel active on file extensions: es6.js, es6, jsx
=> Errors while adding packages:
While building package mizzao:turkserver:
error: couldn't install npm package
I am developing my Meteor application on a Windows 7 machine and from what I have been able to gather from posts on forums, the error seems to be related to that fact (interaction between npm and Windows - I did not find any posts describing the same problem on Linux machines).
I've already tried installing the latest Python version and MS Visual Studio 2013 as suggested here: https://github.com/TooTallNate/node-gyp#installation, as well as setting some environment variables as suggested here: https://github.com/atom/atom/issues/2754. But none of those helped.
Any help would be greatly appreciated!
As I described in this comment, this seems to be an issue with the Python path being set incorrectly for npm, as Meteor's distribution of npm isn't hooking it up correctly. Most Linux distros come with Python, but Windows doesn't, so it is correlated with running Windows.
It can be fixed by making sure that Python is installed, then running the following command:
npm config set python C:\Python27\python.exe
The use of an old libxmljs is because mizzao:turkserver is dependent on a relatively old node MTurk API, which I'd like to wean it off of at some point, but isn't such a high priority at the moment.
See also:
https://github.com/lovell/sharp/issues/163
https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/

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