[英]Failed to create app with create-react-app in Linux 16.04
我正在尝试使用create-react-app创建新应用。
下面是错误。
请帮忙。 提前致谢
➜ REACT create-react-app my-app Creating a new React app in /media/budi/Tjung/#TJUNG/REACT/my-app. Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts... yarn add v1.6.0 info No lockfile found. [1/4] Resolving packages... error An unexpected error occurred: "http://registry.npmjs.org/react: > ETIMEDOUT". info If you think this is a bug, please open a bug report with the information provided in "/media/budi/Tjung/#TJUNG/REACT/my-app/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. Aborting installation. yarnpkg add --exact react react-dom react-scripts --cwd /media/budi/Tjung/#TJUNG/REACT/my-app has failed. Deleting generated file... package.json Deleting generated file... yarn-error.log Deleting my-app / from /media/budi/Tjung/#TJUNG/REACT Done.
在我看来是网络问题。 您可能在代理之后。 如果是这种情况,请像这样在npm中配置代理
npm config set proxy http://proxy_host:port
对于https
npm config set https-proxy http://proxy.company.com:8080
注意 :https-proxy的协议不是https,而是http。
您也可以选择尝试,
npm config set strict-ssl false
签出这个答案
检查系统上是否存在npm。
按此顺序尝试命令。 1. npm install --save create-react-app 2. create-react-app projectname
项目名称必须小写
假设已安装Node,则可以使用npm安装create-react-native-app命令行实用程序:
npm install -g create-react-native-app
然后运行以下命令来创建一个名为“ my-app”的新React Native项目:
create-react-native-app my-app
cd my-app
npm start
我已经解决了这个问题..这是关于互联网速度连接。 。 当我遇到这个问题时,我花了一天的时间找到解决方案。 我读了很多关于ETIMEDOUT的文章。 我已经卸载并重新安装了npm和yarn。 仍然不能解决我的问题。 。 在那之前,我发现了可以高速上网的地方。 幸运的是,我可以使用create-react-app创建新应用。
我认为您的npm软件包配置有问题。
也许在某处,您为npm变量设置了一些代理配置。
您可以在终端中重置运行此脚本的配置
sudo sh -c 'echo "" > $(npm config get globalconfig)'
等到过程结束并运行
exit
打开另一个终端窗口,然后尝试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.