问答

npm 安装其他包出错

作者:admin 2021-08-03 我要评论

问题描述 npm安装包总是出现超时的问题 ,npm的配置也没有代理 问题出现的环境背景及自己尝试过哪些方法 相关代码 npm配置如下 λ npm config ls -l; cli config...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

image.png

问题描述

npm安装包总是出现超时的问题 ,npm的配置也没有代理

问题出现的环境背景及自己尝试过哪些方法

相关代码

npm配置如下

λ npm config ls -l
; cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.4.1 node/v10.15.1 win32 x64"

; builtin config undefined
prefix = "C:\\Users\\yangb-g\\AppData\\Roaming\\npm"

; default values
access = null
allow-same-version = false
also = null
always-auth = false
audit = true
audit-level = "low"
auth-type = "legacy"
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\yangb-g\\AppData\\Roaming\\npm-cache"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
dry-run = false
editor = "notepad.exe"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "C:\\Users\\yangb-g\\AppData\\Roaming\\npm\\etc\\npmrc"
globalignorefile = "C:\\Users\\yangb-g\\AppData\\Roaming\\npm\\etc\\npmignore"
group = 0
ham-it-up = false
heading = "npm"
https-proxy = null
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\yangb-g\\.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "notice"
logs-max = 10
; long = false (overridden)
maxsockets = 50
message = "%s"
; metrics-registry = null (overridden)
node-options = null
node-version = "10.15.1"
noproxy = null
offline = false
onload-script = null
only = null
optional = true
otp = null
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
; prefix = "C:\\Program Files\\nodejs" (overridden)
preid = ""
production = false
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
scripts-prepend-node-path = "warn-only"
searchexclude = null
searchlimit = 20
searchopts = ""
searchstaleness = 900
send-metrics = false
shell = "C:\\windows\\system32\\cmd.exe"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "C:\\Users\\yangb-g\\AppData\\Local\\Temp"
umask = 0
unicode = false
unsafe-perm = true
update-notifier = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
userconfig = "C:\\Users\\yangb-g\\.npmrc"
version = false
versions = false
viewer = "browser"

你期待的结果是什么?实际看到的错误信息又是什么?

###

上面显示没有连接到104.16.25.34:443, 这说明依赖包没有发布到npm上面去,而是放在自已的服务器上,所以你要切换一下npm的镜像,尝试是否能够下载下来(npm config set registry http://104.16.25.34:443)

###

用cnpm试试

###

cnpm下载的包有时候有些问题,建议使用nrm切换npm的源,
npm i nrm -g
nrm use taobao
或者使用yarn
npm i yarn -g

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • npm 安装其他包出错

    npm 安装其他包出错

  • 移动端H5可以实现长按二维码识别功能

    移动端H5可以实现长按二维码识别功能

  • JS对象数组如何实现多属性查询?

    JS对象数组如何实现多属性查询?

  • Javascript 位运算与Java位运算结果不

    Javascript 位运算与Java位运算结果不

腾讯云代理商
海外云服务器