Reactjs 我正在尝试使用(create react app app name)创建一个react app,但显示错误,有人能告诉我原因吗?

Reactjs 我正在尝试使用(create react app app name)创建一个react app,但显示错误,有人能告诉我原因吗?,reactjs,react-native,npm,react-redux,node-modules,Reactjs,React Native,Npm,React Redux,Node Modules,我尝试过清除缓存,但这并不能解决我的问题。它一直工作到几个小时前。之后,我在另一个项目中使用了npm run eject。在那之后,我犯了这个错误。我将随日志附上一个错误文件。有人能帮我吗 错误 Creating a new React app in F:\React Learning\meals\meal-app. Installing packages. This might take a couple of minutes. Installing react, react-dom, a

我尝试过清除缓存,但这并不能解决我的问题。它一直工作到几个小时前。之后,我在另一个项目中使用了
npm run eject
。在那之后,我犯了这个错误。我将随日志附上一个错误文件。有人能帮我吗

错误


Creating a new React app in F:\React Learning\meals\meal-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/react failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
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\pcmaster\AppData\Roaming\npm-cache\_logs\2020-06-06T14_53_15_643Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
Deleting meal-app/ from F:\React Learning\meals
Done.

F:\React Learning\meals>
生成的日志文件

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   '--save',
1 verbose cli   '--save-exact',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   'react',
1 verbose cli   'react-dom',
1 verbose cli   'react-scripts',
1 verbose cli   'cra-template' ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose npm-session bb041aca5c7d9fbf
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for react@latest request to https://registry.npmjs.org/react failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
8 silly fetchPackageMetaData error for react-dom@latest request to https://registry.npmjs.org/react-dom failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
9 silly fetchPackageMetaData error for react-scripts@latest request to https://registry.npmjs.org/react-scripts failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
10 silly fetchPackageMetaData error for cra-template@latest request to https://registry.npmjs.org/cra-template failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
11 timing stage:rollbackFailedOptional Completed in 3ms
12 timing stage:runTopLevelLifecycles Completed in 363ms
13 verbose type system
14 verbose stack FetchError: request to https://registry.npmjs.org/react failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
14 verbose stack     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
14 verbose stack     at ClientRequest.emit (events.js:198:13)
14 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:392:9)
14 verbose stack     at TLSSocket.emit (events.js:198:13)
14 verbose stack     at emitErrorNT (internal/streams/destroy.js:91:8)
14 verbose stack     at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
14 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
15 verbose cwd F:\React Learning\meals\meal-app
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts" "cra-template"
18 verbose node v10.16.3
19 verbose npm  v6.9.0
20 error code ENOTFOUND
21 error errno ENOTFOUND
22 error network request to https://registry.npmjs.org/react failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
23 error network This is a problem related to network connectivity.
23 error network In most cases you are behind a proxy or have bad network settings.
23 error network
23 error network If you are behind a proxy, please make sure that the
23 error network 'proxy' config is set properly.  See: 'npm help config'
24 verbose exit [ 1, true ]
我还没有反应过来。我已经使用相同的命令创建了一个react多react应用程序。但是我不知道为什么这次不起作用。我有一个更新的nodejs。

步骤1)使用

npm cache clean --force
步骤2)运行命令:

npx create-react-app my-app

对于npm 5.2+或更高


错误的确切原因尚不清楚。但这两个步骤对我很有效。

在web浏览器上尝试打开“”时,您会得到什么?您是否连接到internet?您是否使用代理?您按照什么步骤创建新项目?您不应该全局安装
create-react-app
。检查步骤。@AjeetShah非常感谢您。它解决了我的问题。