我想使用npm
安装软件包。但是,每当我尝试安装任何东西时,npm
都会崩溃。
这是我一直收到的错误:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'npm' ]
2 info using npm@6.2.0
3 info using node@v10.9.0
4 verbose npm-session 06d9b7b22d5c60b9
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for npm@latest request to http://registry.npmjs.org/npm failed, reason: connect ECONNREFUSED 127.0.0.1:80
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 73386ms
10 verbose type system
11 verbose stack FetchError: request to http://registry.npmjs.org/npm failed, reason: connect ECONNREFUSED 127.0.0.1:80
11 verbose stack at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
11 verbose stack at ClientRequest.emit (events.js:182:13)
11 verbose stack at Socket.socketErrorListener (_http_client.js:391:9)
11 verbose stack at Socket.emit (events.js:182:13)
11 verbose stack at emitErrorNT (internal/streams/destroy.js:82:8)
11 verbose stack at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
11 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19)
12 verbose cwd C:\Users\trinch\repos\gekko
13 verbose Windows_NT 10.0.17134
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "npm"
15 verbose node v10.9.0
16 verbose npm v6.2.0
17 error code ECONNREFUSED
18 error errno ECONNREFUSED
19 error FetchError: request to http://registry.npmjs.org/npm failed, reason: connect ECONNREFUSED 127.0.0.1:80
19 error at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
19 error at ClientRequest.emit (events.js:182:13)
19 error at Socket.socketErrorListener (_http_client.js:391:9)
19 error at Socket.emit (events.js:182:13)
19 error at emitErrorNT (internal/streams/destroy.js:82:8)
19 error at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
19 error at process._tickCallback (internal/process/next_tick.js:63:19)
19 error { FetchError: request to http://registry.npmjs.org/npm failed, reason: connect ECONNREFUSED 127.0.0.1:80
19 error at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
19 error at ClientRequest.emit (events.js:182:13)
19 error at Socket.socketErrorListener (_http_client.js:391:9)
19 error at Socket.emit (events.js:182:13)
19 error at emitErrorNT (internal/streams/destroy.js:82:8)
19 error at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
19 error at process._tickCallback (internal/process/next_tick.js:63:19)
19 error message:
19 error 'request to http://registry.npmjs.org/npm failed, reason: connect ECONNREFUSED 127.0.0.1:80',
19 error type: 'system',
19 error errno: 'ECONNREFUSED',
19 error code: 'ECONNREFUSED',
19 error stack:
19 error 'FetchError: request to http://registry.npmjs.org/npm failed, reason: connect ECONNREFUSED 127.0.0.1:80\n at ClientRequest.req.on.err (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-fetch-npm\\src\\index.js:68:14)\n at ClientRequest.emit (events.js:182:13)\n at Socket.socketErrorListener (_http_client.js:391:9)\n at Socket.emit (events.js:182:13)\n at emitErrorNT (internal/streams/destroy.js:82:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)\n at process._tickCallback (internal/process/next_tick.js:63:19)' }
20 error If you are behind a proxy, please make sure that the
20 error 'proxy' config is set properly. See: 'npm help config'
21 verbose exit [ 1, true ]
我的设置:
我不在代理后面,我的npm
配置列表如下:
; cli configs
metrics-registry = "http://registry.npmjs.org/"
scope = "@xtrinch"
user-agent = "npm/6.2.0 node/v10.9.0 win32 x64"
; userconfig C:\Users\trinch\.npmrc
msvs_version = "2017"
registry = "http://registry.npmjs.org/"
; builtin config undefined
prefix = "C:\\Users\\trinch\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\trinch\repos\gekko
; HOME = C:\Users\trinch
; "npm config ls -l" to show all defaults.
打包版本:
PS C:\Users\trinch> node -v
v10.9.0
PS C:\Users\trinch> npm -v
6.2.0
您知道我该怎么办吗?到目前为止,我对如何解决这个问题一无所知。希望我能在这个问题上获得任何帮助!
如果您确实需要更多信息,请告诉我!
答案 0 :(得分:0)
结果是我意外地将http_proxy
,https_proxy
和代理用户环境变量设置为http://@trinch
,该变量解析为本地主机。删除它们就可以了。