npm npx npx-react-app my-app ERROR“在大多数情况下,您在代理服务器后面.”

b09cbbtk  于 12个月前  发布在  React
关注(0)|答案(3)|浏览(154)

使用npx create-react-app my-app时出错。我是nodereact的新手,我正在尝试创建我的第一个react应用程序。我似乎有相当好的互联网连接。
我尝试了npx create-react-app my-app 6次,但它有相同的错误:

user@Acer:~/ReactProjects$ npx create-react-app my-app

Creating a new React app in /home/user/ReactProjects/my-app.

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

npm ERR! code ETIMEDOUT
npm ERR! syscall read
npm ERR! errno ETIMEDOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/@babel%2fplugin-proposal-async-generator-functions: read ETIMEDOUT
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!     /home/user/.npm/_logs/2022-03-06T11_34_36_543Z-debug-0.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 /home/user/ReactProjects
Done.
user@Acer:~/ReactProjects$

字符串
我在windows 10build 19044上使用vscoderemote wsl extension运行此程序,remote wsl extension连接到wsl2上的ubuntu-20.04。我想创建我的第一个react app我应该从这里做什么?

v9tzhpje

v9tzhpje1#

有时我得到同样的错误时,没有连接网络或网络连接不良。

44u64gxh

44u64gxh2#

尝试使用npm install -g npm@latest --force更新npm

oalqel3c

oalqel3c3#

我有同样的问题,这个错误发生,因为你正在使用代理服务器连接互联网,如果这样停止使用代理将解决它,但如果你想跟上代理遵循这第一个清除缓存

npm cache clear --force

字符串
第二:

npm config set registry http://registry.npmjs.org/


第三:

npm install -g create-react-app


上一页:

create-react-app appName

相关问题