NodeJS npm ERR! code ENOTFOUND我如何修复它?

jk9hmnmh  于 2022-12-03  发布在  Node.js
关注(0)|答案(1)|浏览(448)

我在使用react时遇到了这个问题。
终端内

npx create-react-app myproject

错误信息

npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry/,npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND proxy.company.com
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 ERR! A complete log of this run can be found in:
npm ERR!     /Users/****/.npm/_logs/2022-12-01T16_39_36_991Z-debug-0.log

日志档桉

26 verbose logfile logs-max:10 dir:/Users/****/.npm/_logs
27 verbose logfile /Users/****/.npm/_logs/2022-12-01T16_39_36_991Z-debug-0.log
28 timing npm:load:logFile Completed in 2ms
29 timing npm:load:timers Completed in 0ms
30 timing npm:load:configScope Completed in 0ms
31 timing npm:load Completed in 16ms
32 silly logfile start cleaning logs, removing 5 files
33 timing arborist:ctor Completed in 1ms
34 timing arborist:ctor Completed in 0ms
35 silly logfile done cleaning log files
36 timing command:exec Completed in 70053ms
37 verbose type system
38 verbose stack FetchError: request to https://registry/,npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND proxy.company.com
38 verbose stack     at ClientRequest.<anonymous> (/opt/homebrew/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
38 verbose stack     at ClientRequest.emit (node:events:513:28)
38 verbose stack     at onerror (/opt/homebrew/lib/node_modules/npm/node_modules/agent-base/dist/src/index.js:117:21)
38 verbose stack     at callbackError (/opt/homebrew/lib/node_modules/npm/node_modules/agent-base/dist/src/index.js:136:17)

我已经卸载节点,npm和重新安装它。但它是不成功的create-react-app。
我的节点版本:19.2.0我的npm版本:8.19.3
我电脑里发生的事...🙀

qv7cva1a

qv7cva1a1#

运行此命令

npm config set registry http://registry.npmjs.org/

需要使用http而不是https

相关问题