简体   繁体   English

当我使用 npx create-react-app 制作新的 React 应用程序时出错

[英]error when i make a new react app using npx create-react-app

PS C:\Users\Khldon\Desktop\react bascs> npx create-react-app my-app

Creating a new React app in C:\Users\Khldon\Desktop\react bascs\my-app.

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

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/eslint-config-react-app: Socket timeout
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\Khldon\AppData\Local\npm-cache\_logs\2022-03-10T18_23_30_605Z-debug.log

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

Deleting generated file... package.json
Deleting my-app/ from C:\Users\Khldon\Desktop\react bascs
Done.

node-v:16.14.0节点-v:16.14.0

i'm not using proxy and i have tried every single solution on the inte.net and still have the same error我没有使用代理,我已经尝试了 inte.net 上的每一个解决方案,但仍然有同样的错误

also have tried every solution in this thread: npm not working - "read ECONNRESET"也尝试了此线程中的所有解决方案: npm 不工作 - “读取 ECONNRESET”

Here are the last lines of my log file that I think indicate the problem:这是我认为表明问题的日志文件的最后几行:

3521 http fetch GET 200 https://registry.npmjs.org/lodash.sortby 261ms (cache miss)
3522 http fetch GET 200 https://registry.npmjs.org/webidl-conversions 494ms (cache miss)
3523 http fetch GET 200 https://registry.npmjs.org/tr46 534ms (cache miss)
3524 timing idealTree:node_modules/workbox-build/node_modules/source-map Completed in 540ms
3525 silly placeDep ROOT lodash.sortby@4.7.0 OK for: whatwg-url@7.1.0 want: ^4.7.0
3526 silly placeDep ROOT tr46@1.0.1 OK for: whatwg-url@7.1.0 want: ^1.0.1
3527 silly placeDep ROOT webidl-conversions@4.0.2 OK for: whatwg-url@7.1.0 want: ^4.0.2
3528 timing idealTree:node_modules/whatwg-url Completed in 5ms
3529 timing idealTree:node_modules/lodash.sortby Completed in 0ms
3530 timing idealTree:node_modules/tr46 Completed in 0ms
3531 timing idealTree:node_modules/webidl-conversions Completed in 0ms
3532 silly placeDep node_modules/workbox-webpack-plugin source-map@0.6.1 OK for: webpack-sources@1.4.3 want: ~0.6.1
3533 timing idealTree:node_modules/workbox-webpack-plugin/node_modules/webpack-sources Completed in 2ms
3534 timing idealTree:node_modules/workbox-webpack-plugin/node_modules/source-map Completed in 0ms
3535 timing idealTree:buildDeps Completed in 5489589ms
3536 timing idealTree:fixDepFlags Completed in 35ms
3537 timing idealTree Completed in 5489651ms
3538 timing command:install Completed in 5489669ms
3539 verbose type system
3540 verbose stack FetchError: request to http://registry.npmjs.org/js-tokens failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
3540 verbose stack     at ClientRequest.<anonymous> (C:\Users\Khldon\AppData\Roaming\nvm\v16.13.0\node_modules\npm\node_modules\minipass-fetch\lib\index.js:110:14)
3540 verbose stack     at ClientRequest.emit (node:events:390:28)
3540 verbose stack     at Socket.socketErrorListener (node:_http_client:447:9)
3540 verbose stack     at Socket.emit (node:events:402:35)
3540 verbose stack     at emitErrorNT (node:internal/streams/destroy:157:8)
3540 verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:122:3)
3540 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
3541 verbose cwd C:\Users\Khldon\Desktop\react bascs\my-app
3542 verbose Windows_NT 10.0.19042
3543 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--no-audit" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts" "cra-template"
3544 verbose node v16.13.0
3545 verbose npm  v8.1.0
3546 error code ENOTFOUND
3547 error syscall getaddrinfo
3548 error errno ENOTFOUND
3549 error network request to http://registry.npmjs.org/js-tokens failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
3550 error network This is a problem related to network connectivity.
3550 error network In most cases you are behind a proxy or have bad network settings.
3550 error network
3550 error network If you are behind a proxy, please make sure that the
3550 error network 'proxy' config is set properly.  See: 'npm help config'
3551 verbose exit 1

See: https://www.jhipster.tech/configuring-a-corporate-proxy参见: https://www.jhipster.tech/configuring-a-corporate-proxy

Use these commands:使用这些命令:

npm config set proxy http://username:password@host:port
npm config set https-proxy http://username:password@host:port

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 npx create-react-app 时收到此错误消息 - Getting this error messages when using npx create-react-app wan 我使用 npx create-react-app App_Name 创建新的反应应用程序显示此错误(发现 8 个漏洞) - wan i create new react App using npx create-react-app App_Name Its Show This Error (found 8 vulnerabilities) Ubuntu 中的 npx create-react-app 错误 - Error with npx create-react-app in Ubuntu 安装 npx create-react-app 时发现错误 - error found when we install npx create-react-app 尝试使用 npx create-react-app 时出现超时错误 - Timeout error when trying to use npx create-react-app 使用 npx 在 Windows 中创建新的 React 应用程序时出错 - Error when create a new React App in Windows using npx 创建反应应用程序错误:内部/模块/cjs/loader.js:311,使用 npx 创建反应应用程序时 - Create-react-app error : internal/modules/cjs/loader.js:311 , when using npx to create a react app 使用 npx create-react-app 创建应用后<myproject> ,并使用“npm start”启动应用程序我得到了下面提到的这个错误</myproject> - After creating app using npx create-react-app <myproject> , and start app by using "npm start" i got this error mentioned below npx create-react-app 不工作。 出现“create-react-app 的过时版本”错误 - npx create-react-app NOT working. Getting "outdated version of create-react-app" error npx create-react-app 命令不起作用 - npx create-react-app command is not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM