一个困扰了我一周的问题,求大神助攻
发布于 7 年前 作者 DukeAnn 11906 次浏览 来自 问答

npm 安装组件的时候就报错,cause=getaddrinfo ENOTFOUND 3128 3128:80,3128 是我的代理端口,但是我已经关闭代理了,npm也没有设置代理,为什么总是报这个错误呢,npm还有其他地方能设置代理吗?我电脑可以正常上网看网页 2 info using npm@3.10.10 3 info using node@v6.10.2 4 silly loadCurrentTree Starting 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 silly fetchPackageMetaData npm 8 silly fetchNamedPackageData npm 9 silly mapToRegistry name npm 10 silly mapToRegistry using default registry 11 silly mapToRegistry registry https://registry.npmjs.org/ 12 silly mapToRegistry data Result { 12 silly mapToRegistry raw: ‘npm’, 12 silly mapToRegistry scope: null, 12 silly mapToRegistry escapedName: ‘npm’, 12 silly mapToRegistry name: ‘npm’, 12 silly mapToRegistry rawSpec: ‘’, 12 silly mapToRegistry spec: ‘latest’, 12 silly mapToRegistry type: ‘tag’ } 13 silly mapToRegistry uri https://registry.npmjs.org/npm 14 verbose request uri https://registry.npmjs.org/npm 15 verbose request no auth needed 16 info attempt registry request try #1 at 11:31:32 PM 17 verbose request id e6d71243c40b9244 18 http request GET https://registry.npmjs.org/npm 19 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 3128 3128:80 20 info attempt registry request try #2 at 11:31:44 PM 21 http request GET https://registry.npmjs.org/npm 22 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 3128 3128:80 23 info attempt registry request try #3 at 11:32:46 PM 24 http request GET https://registry.npmjs.org/npm 25 silly fetchPackageMetaData Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 3128 3128:80 25 silly fetchPackageMetaData at ClientRequest.onError (C:\Program Files\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:176:17) 25 silly fetchPackageMetaData at ClientRequest.g (events.js:291:16) 25 silly fetchPackageMetaData at emitOne (events.js:96:13) 25 silly fetchPackageMetaData at ClientRequest.emit (events.js:188:7) 25 silly fetchPackageMetaData at Socket.socketErrorListener (_http_client.js:309:9) 25 silly fetchPackageMetaData at emitOne (events.js:96:13) 25 silly fetchPackageMetaData at Socket.emit (events.js:188:7) 25 silly fetchPackageMetaData at connectErrorNT (net.js:1025:8) 25 silly fetchPackageMetaData at _combinedTickCallback (internal/process/next_tick.js:80:11) 25 silly fetchPackageMetaData at process._tickCallback (internal/process/next_tick.js:104:9) 25 silly fetchPackageMetaData error for npm { Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 3128 3128:80 25 silly fetchPackageMetaData at ClientRequest.onError (C:\Program Files\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:176:17) 25 silly fetchPackageMetaData at ClientRequest.g (events.js:291:16) 25 silly fetchPackageMetaData at emitOne (events.js:96:13) 25 silly fetchPackageMetaData at ClientRequest.emit (events.js:188:7) 25 silly fetchPackageMetaData at Socket.socketErrorListener (_http_client.js:309:9) 25 silly fetchPackageMetaData at emitOne (events.js:96:13) 25 silly fetchPackageMetaData at Socket.emit (events.js:188:7) 25 silly fetchPackageMetaData at connectErrorNT (net.js:1025:8) 25 silly fetchPackageMetaData at _combinedTickCallback (internal/process/next_tick.js:80:11) 25 silly fetchPackageMetaData at process._tickCallback (internal/process/next_tick.js:104:9) code: ‘ECONNRESET’ } 26 silly rollbackFailedOptional Starting 27 silly rollbackFailedOptional Finishing 28 silly runTopLevelLifecycles Finishing 29 silly install printInstalled 30 verbose stack Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 3128 3128:80 30 verbose stack at ClientRequest.onError (C:\Program Files\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:176:17) 30 verbose stack at ClientRequest.g (events.js:291:16) 30 verbose stack at emitOne (events.js:96:13) 30 verbose stack at ClientRequest.emit (events.js:188:7) 30 verbose stack at Socket.socketErrorListener (_http_client.js:309:9) 30 verbose stack at emitOne (events.js:96:13) 30 verbose stack at Socket.emit (events.js:188:7) 30 verbose stack at connectErrorNT (net.js:1025:8) 30 verbose stack at _combinedTickCallback (internal/process/next_tick.js:80:11) 30 verbose stack at process._tickCallback (internal/process/next_tick.js:104:9) 31 verbose cwd C:\Users\ADKi 32 error Windows_NT 10.0.14393 33 error argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install” “npm” "-g" 34 error node v6.10.2 35 error npm v3.10.10 36 error code ECONNRESET 37 error network tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 3128 3128:80 38 error network This is most likely not a problem with npm itself 38 error network and is related to network connectivity. 38 error network In most cases you are behind a proxy or have bad network settings. 38 error network 38 error network If you are behind a proxy, please make sure that the 38 error network ‘proxy’ config is set properly. See: 'npm help config’ 39 verbose exit [ 1, true ]

7 回复

npm config list -l 看看 proxy

@atian25 这个是null 我已经把 npm config 设置的代理全删了。不知道为什么还是走代理

环境变量有没有 http_proxy ?

@atian25 哪个的环境变量

; cli configs
user-agent = "npm/3.10.10 node/v6.10.2 win32 x64"

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

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\ADKi\Desktop
; HOME = C:\Users\ADKi
; "npm config ls -l" to show all defaults.

去检查你的 git 配置是不是开着代理

@pinxue 没有用,又清除了一次代理还是报错

$ npm install npm -g
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "npm" "-g"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! code ECONNRESET

npm ERR! network tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 3128 3128:80
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\ADKi\Desktop\npm-debug.log

ADKi@DESKTOP-HD7UVDG MINGW64 ~/Desktop
$ npm config get https-proxy
null

ADKi@DESKTOP-HD7UVDG MINGW64 ~/Desktop
$ npm config get proxy
null
回到顶部