npm install
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning undefined: network timeout at: https://registry.npmjs.org/js-cookie
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN irps-monitor@2.0.0 No repository field.

npm ERR! network timeout at: https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.0.tgz

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-11-17T22_32_57_968Z-debug.log

修改npm仓库源:npm config set registry https://registry.npm.taobao.org/,重新执行npm install成功

设置npm源的几种方式

原始源
#the original source
https://registry.npmjs.org/

方案1: 改变全局注册

#设置淘宝
npm config set registry https://registry.npm.taobao.org
#查看结果
npm config get registry
#输出结果
https://registry.npm.taobao.org/
#测试一下
npm info underscore

方案2: 使用nrm

安装
npm install -g nrm
列出源的候选项
nrm ls
输出结果:

* npm -------- https://registry.npmjs.org/
  yarn ------- https://registry.yarnpkg.com/
  cnpm ------- http://r.cnpmjs.org/
  taobao ----- https://registry.npm.taobao.org/
  nj --------- https://registry.nodejitsu.com/
  npmMirror -- https://skimdb.npmjs.com/registry/
  edunpm ----- http://registry.enpmjs.org/
使用淘宝源
nrm use taobao

方案3: 在命令行指定

npm --registry https://registry.npm.taobao.org install [name]

方案4: 修改 ~/.npmrc

registry = https://registry.npm.taobao.org

方案5: 使用cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install [name]

原文地址:https://blog.csdn.net/weixin_46031767/article/details/127918583

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_46152.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注