簡體   English   中英

在Linux 16.04中無法使用create-react-app創建應用

[英]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.

CLI的錯誤圖片

在我看來是網絡問題。 您可能在代理之后。 如果是這種情況,請像這樣在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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM