简体   繁体   English

无法安装 npm 包(无可见错误,无进展)

[英]Unable to install npm package (No visible error,no progress)

I'm not able to install any npm package through my local internet.我无法通过本地互联网安装任何 npm 包。 But when I switch to the mobile internet it works perfectly.但是当我切换到移动互联网时,它工作得很好。 How can I fix this?我怎样才能解决这个问题?

First of all , Here is the output of my npm config :首先,这是我的 npm 配置的输出:

cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"  
scope = ""
user-agent = "npm/6.14.8 node/v12.18.4 win32 x64" 

; userconfig C:\Users\iblue\.npmrc
registry = "https://registry.npmjs.org/"

; builtin config undefined
prefix = "C:\\Users\\iblue\\AppData\\Roaming\\npm"

; default values
access = null
allow-same-version = false
also = null
always-auth = false
audit = true
audit-level = "low"
auth-type = "legacy"
before = null
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\iblue\\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
format-package-lock = true
fund = true
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "C:\\Users\\iblue\\AppData\\Roaming\\npm\\etc\\npmrc"
globalignorefile = "C:\\Users\\iblue\\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\\iblue\\.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 = "12.18.4"
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\\iblue\\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} {ci}" (overridden)
userconfig = "C:\\Users\\iblue\\.npmrc"
version = false
versions = false
viewer = "browser"


Here what I tried and what I got with using -verbose flag :这是我尝试过的以及使用 -verbose 标志得到的结果:

stucks at here, no progress卡在这里,没有进展

npm info it worked if it ends with ok
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\iblue\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'i',
npm verb cli   'fs-extra',
npm verb cli   '-verbose'
npm verb cli ]
npm info using npm@6.14.8
npm info using node@v12.18.4
npm verb npm-session d3224614775b0bbf
[..................] / rollbackFailedOptional: verb npm-session d3224614775b0bbf

I tried to clean the cache and I got two more steps but stuck at here我试图清理缓存,我又做了两个步骤,但卡在了这里

npm info using npm@6.14.8
npm info using node@v12.18.4
npm verb npm-session 8b89e4fdb645fa26
npm http fetch GET 200 https://registry.npmjs.org/fs-extra 547ms
npm http fetch GET 200 https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz 119ms
npm timing stage:loadCurrentTree Completed in 3005ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 24ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 994ms
npm http fetch GET 200 https://registry.npmjs.org/at-least-node 124ms
npm http fetch GET 200 https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz 110ms
[..................] | fetchMetadata: http fetch GET 200 https://registry.npmjs.o

Note As a first thing, run npm install --verbose to see more!注意首先,运行 npm install --verbose 以查看更多信息!

Try without https:尝试不使用 https:

npm config set registry http://registry.npmjs.org/ --global
npm cache clear --force
Remove package-lock.json
Remove node_modules folder
npm install --verbose 

if it doesn't work then如果它不起作用那么

npm config delete proxy
npm config delete https-proxy
npm set registry https://registry.npmjs.org/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM