npm 创建react项目时出错npx react-app

0tdrvxhp  于 2023-11-18  发布在  React
关注(0)|答案(2)|浏览(139)

在Visual Studio代码中,我得到了第二部分错误,第一部分我甚至不能在终端上安装任何npm。

npm install -g npm@latest
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://registry.npmjs.org/npm failed, reason:
npm ERR!     at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR!     at ClientRequest.emit (node:events:514:28)
npm ERR!     at _destroy (node:_http_client:875:13)
npm ERR!     at onSocketNT (node:_http_client:895:5)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR!  FetchError: request to http://registry.npmjs.org/npm failed, reason:
npm ERR!     at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR!     at ClientRequest.emit (node:events:514:28)
npm ERR!     at _destroy (node:_http_client:875:13)
npm ERR!     at onSocketNT (node:_http_client:895:5)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   type: 'system'
npm ERR! }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'

个字符
我试图改变代理,这一次它给了我一个关于代理的错误,作为一个默认的im使用localhost:8080

v8wbuo2f

v8wbuo2f1#

我在github上找到了这个,它很有效:

> npm config set proxy null
> npm config set https-proxy null
> npm config set registry http://registry.npmjs.org/
> npm install -g react-native-cli

字符串

rnmwe5a2

rnmwe5a22#

使用vite代替

npm create vite@latest

字符串

相关问题