What causes npm to emit a getaddrinfo error? - npm

I am trying to install a package with npm, but I get this kind of error for any npm commands:
npm -h
rcmd: getaddrinfo: nodename nor servname provided, or not known
This happens on a Mac (Ventura 13.1). npm 19.6.1 is installed via homebrew. I guess it is some kind of DNS issue, but I don't know how to get further. I couldn't find this specific error in many searches. Any ideas?

Related

Force NPM to skip package already installed from another source

I'm trying to npm install a package from a heavily proxied Enterprise computer. One of the dependencies of this package tries to install via GitHub, which throws a 407 error.
npm ERR! /usr/bin/git ls-remote -h -t https://github.com/ethereumjs/ethereumjs-abi.git
npm ERR!
npm ERR! fatal: unable to access 'https://github.com/ethereumjs/ethereumjs-abi.git/': Received HTTP code 407 from proxy after CONNECT
I've discussed this with the team that manages these servers- even with proper proxy authentication, access to sites outside of internal registries are very uncommon as a security measure.
As an alternative, I found the package on the NPM registry, and successfully installed it using the internal mirror we have. However, it still tries to install the GitHub version as a dependency of the first package, and then the installation fails. Is there any way to prevent this? I think I've seen something about editing the package's package.json to remove the dependency, but I don't have any experience with this, so I'll only do it if it's the only option to prevent this. Thank you

Host key verification failed.. fatal: Could not read from remote repository

I just uninstalled loopback/cli using npm uninstall loopback/cli.Now I can't install it again and giving this error " Host key verification failed. fatal: Could not read from remote repository."
Any ideas why?
My npm version is 6.13.0
Thanks in advance.
The problem was that the command was wrong. It is npm install -g #loopback/cli. I was typing npm install -g loopback/cli

500 Internal Server Error: npm#latest

I have a problem with npm I can't get any package. For example running :
npm install -g npm#latest
gives :
npm ERR! code E500 npm ERR!
500 Internal Server Error: npm#latest
If I try to access https://registry.npmjs.org/ I get :
Fastly error: unknown domain.
Please check that this domain has been added to a service.
I looked into my /etc/hosts and nothing wrong there, any ideas ?
---------------- INFOS -----------
NodeJS : v9.2.0
npm : 6.0.1
OS : Ubuntu 16.04.4 LTS
Below step resolve my npm registry issue. I hope same will be work for you.
Try to set npm registry using : npm config set registry https://registry.npmjs.org/
Check result of curl https://registry.npmjs.org/
Clear the cache: npm cache clean --force
Try to run npm install
From corporate network sometimes you won't be able to properly resolve registry.npmjs.org. To workaround the problem do the following.
dig registry.npmjs.org #1.1.1.1
Take any of the ip in the output and add to /etc/hosts
104.16.16.35 registry.npmjs.org
You should be good to go now.
I also faced the same issue.
Below solution worked for me at least:
comment out this part in windows hosts file
# 151.101.0.162 registry.npmjs.org
500 error indicates issue with the server. Yesterday I was facing this issue whenever I tried installing packages with npm. Upon searching a bit, I found status.npmjs.org. It's a page that shows the current status of npm registry. There was an outage due to DNS misconfiguration which was mentioned on the page.I kept checking the status page, and eventually there was a status update :
Update - This has now been resolved for most users and we will continue to monitor until it has cleared for everyone.
Sep 1, 17:13 UTC
After this update, I was able to install packages without any issues.

npm generator-ionic Install Requires yo#>=1.0.0

I'm trying to install generator-ionic, and I get the following fatal error:
EPEERINVALID generator-ionic#0.7.3 requires a peer of yo#>=1.0.0 but none was installed
I'm using node 0.12.17, npm 3.3.6, and yo 1.4.7, so I do not understand what isn't satisfied.
#chrysanhy I think I found the issue. I just downgraded my npm version to 2.7.4 and when I ran the command npm install generator-ionic-g the following message appeared:
npm WARN peerDependencies The peer dependency yo#>=1.0.0 included from generator-ionic will no longer be automatically installed to fulfill the peerDependency in npm 3+. Your application will need to depend on it explicitly.
Now the ionic-generator is working fine on my machine. Hope this helps you and everyone who is facing the same problem.

Diagnosing npm’s “invalid” error in package list

When I do npm list --global, one package, phonegap, shows as invalid.
npm ERR! invalid: phonegap#5.0.0-0.28.1 /usr/local/lib/node_modules/phonegap
No other packages have any errors or problems. I’ve tried to look into this, and learned that the message means a dependency is unfulfilled, but I can’t figure out which one. If I run npm update --global phonegap it exits cleanly, with no errors.
I originally installed npm & node via Homebrew, if that’s relevant. Here’s my full list of globally installed packages.
How do I diagnose this?
Have you tried changing the permissions for that package? I recently had a similar problem with global packages and it turned out to be a permissions issue
https://docs.npmjs.com/getting-started/fixing-npm-permissions