简体   繁体   中英

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

i'm not using proxy and i have tried every single solution on the inte.net and still have the same error

also have tried every solution in this thread: npm not working - "read 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

Use these commands:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM