centos npm install 超时报错

2023-05-16

使用npm install 时报错

[root@localhost helloworld]# npm install forever -g
npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/forever-monitor 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/2019-07-12T21_28_34_755Z-debug.log

查看npm源地址

npm config get registry

#http://registry.npmjs.org 为国外镜像地址
  • 设置阿里云镜像
npm config set registry http://registry.npm.taobao.org

#如果不能解决
npm install --registry=https://registry.npm.taobao.org

重新运行npm命令,解决

转载于:https://www.cnblogs.com/dch0/p/11205788.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

centos npm install 超时报错 的相关文章

随机推荐