npm install会给出“ npm ERR!代码ENOTFOUND'错误

时间:2019-10-10 19:02:34

标签: node.js reactjs npm

正如标题所示,我对npm install有疑问。今天,在我的开发站点上,我注意到我的一个软件包reactjs-popup丢失了Module not found: Can't resolve 'reactjs-popup' in 'pathway-to-file'错误。结果,我尝试再次安装该模块,但收到此错误:

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/reactjs-popup failed, reason: getaddrinfo ENOTFOUND proxy.company.com proxy.company.com:8080
npm ERR! network This is a problem 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 config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

但没有任何运气。这是我的错误日志:

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   'reactjs-popup' ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose npm-session 163a96058a70d601
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for reactjs-popup@^1.5.0 request to http://registry.npmjs.org/reactjs-popup failed, reason: getaddrinfo ENOTFOUND proxy.company.com proxy.company.com:8080
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 1759ms
10 verbose type system
11 verbose stack FetchError: request to http://registry.npmjs.org/reactjs-popup failed, reason: getaddrinfo ENOTFOUND proxy.company.com proxy.company.com:8080
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:198:13)
11 verbose stack     at Socket.socketErrorListener (_http_client.js:392:9)
11 verbose stack     at Socket.emit (events.js:198:13)
11 verbose stack     at emitErrorNT (internal/streams/destroy.js:91:8)
11 verbose stack     at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
11 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
12 verbose cwd C:\Users\jschriem\Desktop\jsdash\frontend
13 verbose Windows_NT 10.0.17763
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "reactjs-popup"
15 verbose node v10.16.0
16 verbose npm  v6.9.0
17 error code ENOTFOUND
18 error errno ENOTFOUND
19 error network request to http://registry.npmjs.org/reactjs-popup failed, reason: getaddrinfo ENOTFOUND proxy.company.com proxy.company.com:8080
20 error network This is a problem related to network connectivity.
20 error network In most cases you are behind a proxy or have bad network settings.
20 error network
20 error network If you are behind a proxy, please make sure that the
20 error network 'proxy' config is set properly.  See: 'npm help config'
21 verbose exit [ 1, true ]

任何帮助将不胜感激,因为我被困了很长时间,而其他资源也没有被证明有太大帮助。谢谢!

1 个答案:

答案 0 :(得分:1)

您将不得不删除该代理。尝试先使用delete npmrc,然后再使用install react-scripts