[英]I am trying to create react app but failed. It show error
Creating a new React app in G:\my-react-projects\dovana.在 G:\my-react-projects\dovana 中创建一个新的 React 应用程序。
Installing packages.安装软件包。 This might take a couple of minutes.
这可能需要几分钟。 Installing react, react-dom, and react-scripts with cra-template...
使用 cra-template 安装 react、react-dom 和 react-scripts...
npm ERR. npm 错误。 code ERR_SOCKET_TIMEOUT npm ERR.
代码 ERR_SOCKET_TIMEOUT npm ERR。 network Socket timeout npm ERR, network This is a problem related to network connectivity.
network Socket timeout npm ERR, network 这是与网络连接有关的问题。 npm ERR: network In most cases you are behind a proxy or have bad network settings.
npm ERR:网络 在大多数情况下,您使用代理服务器或网络设置错误。 npm ERR!
npm 错误! network npm ERR!
网络 npm ERR! network If you are behind a proxy, please make sure that the npm ERR!
网络 如果您在代理后面,请确保 npm ERR! network 'proxy' config is set properly.
网络“代理”配置设置正确。 See: 'npm help config'
请参阅:'npm 帮助配置'
npm ERR: A complete log of this run can be found in: npm ERR. npm ERR:此运行的完整日志可在以下位置找到:npm ERR。 C:\Users\M Monayem Hossain\AppData\Local\npm-cache_logs\2021-12-23T14_13_40_614Z-debug-0.log
C:\Users\M Monayem Hossain\AppData\Local\npm-cache_logs\2021-12-23T14_13_40_614Z-debug-0.log
Aborting installation.中止安装。 npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
npm install --no-audit --save --save-exact --loglevel 错误 react-dom react-scripts cra-template 失败。
Deleting generated file... package.json Deleting dovana/ from G:\my-react-projects Done.正在删除生成的文件... package.json 从 G:\my-react-projects 中删除 dovana/ 完成。
Try clearing cache and then rerun the setup again尝试清除缓存,然后重新运行设置
npm cache clean --force
npm install create-react-app
npx create-react-app my-app
try to install anything from NPM to confirm this is an issue with your connection.尝试从 NPM 安装任何东西,以确认这是您的连接问题。 npm install -g create-react-app.
npm 安装 -g create-react-app。 If this (or any other package) succeeds, it may be other issue.
如果此(或任何其他软件包)成功,则可能是其他问题。
Consider as well it could be an issue with npx on your machine.还要考虑这可能是您机器上的 npx 问题。 Try installing it using create-react-app directly instead by first installing it globally (like I showed above)
尝试直接使用 create-react-app 安装它,而不是先全局安装它(就像我上面展示的那样)
Also try this也试试这个
npm config set registry http://registry.npmjs.org/ npm 配置集注册表http://registry.npmjs.org/
and this和这个
npm set timeout=100000 npm 设置超时=100000
can you set the npm timeout value to a longer time:您可以将 npm 超时值设置为更长的时间吗:
Step 1:步骤1:
Can you create a local file called.npmrc In the folder set the value for timeout to be:timeout=100000你可以在文件夹中创建一个名为.npmrc 的本地文件,将超时的值设置为:timeout=100000
or或者
Run the following:运行以下命令:
npm set timeout=100000
Step 2:第2步:
Finally run the following set of commands:最后运行以下命令集:
npm cache clean --force
npm install create-react-app
npx create-react-app ./
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.