尝试运行npx create-react-app myapp时遇到问题

时间:2020-07-21 11:56:39

标签: node.js reactjs npm

尝试运行npx create-react-app my-app时遇到问题 下面是详细信息,

E:\>npx create-react-app myapp
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND host
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!     C:\Users\Abhilash\AppData\Roaming\npm-cache\_logs\2020-07-21T11_35_42_783Z-debug.log
Install for [ 'create-react-app@latest' ] failed with code 1

日志:

0 info it worked if it ends with ok
1 verbose cli [
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   'create-react-app@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   'C:\\Users\\Abhilash\\AppData\\Roaming\\npm-cache\\_npx\\10908',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   '--json'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v14.3.0
4 verbose npm-session 5a581b78d647a254
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for create-react-app@latest request to http://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND host
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 2339ms
10 verbose type system
11 verbose stack FetchError: request to http://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND host
11 verbose stack     at ClientRequest.<anonymous> (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:315:20)
11 verbose stack     at Socket.socketErrorListener (_http_client.js:467:9)
11 verbose stack     at Socket.emit (events.js:315:20)
11 verbose stack     at emitErrorNT (internal/streams/destroy.js:100:8)
11 verbose stack     at emitErrorCloseNT (internal/streams/destroy.js:68:3)
11 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:84:21)
12 verbose cwd E:\
13 verbose Windows_NT 10.0.18363
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "create-react-app@latest" "--global" "--prefix" "C:\\Users\\Abhilash\\AppData\\Roaming\\npm-cache\\_npx\\10908" "--loglevel" "error" "--json"
15 verbose node v14.3.0
16 verbose npm  v6.14.5
17 error code ENOTFOUND
18 error errno ENOTFOUND
19 error network request to http://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND host
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 ]

我可以看到错误是在淘汰代理服务器设置,但是我没有使用任何这些设置,并且我的代理服务器设置在下面, enter image description here

有人遇到这个问题吗?

1 个答案:

答案 0 :(得分:0)

这对我有用

  1. npm 配置集注册表 https://registry.npm.taobao.org
  2. npx create-react-app my-app

取自https://www.programmersought.com/article/67016822875/