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进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。