簡體   English   中英

第一個帶有 create-react-app 的應用程序,npm 開始不起作用

[英]First app with create-react-app, npm start not working

我正在嘗試創建我的第一個 React 應用程序並基本上在步驟 1 中遇到問題。我正在嘗試在默認的 create-react-app 安裝上使用 npm start 並且出現以下錯誤。 我已經包含了顯示 create-react-app 成功運行的屏幕截圖,但這並沒有解決任何問題。 我已經包含了它成功運行 create-react-app 和我運行 npm start 但沒有運氣的截圖。 謝謝。

這是日志文件:

18 詳細 npm v6.4.1 19 錯誤文件 sh 20 錯誤代碼 ELIFECYCLE 21 錯誤 errno ENOENT 22 錯誤系統調用 spawn 23 錯誤 robofriends@0.1.0 start: react-scripts start 23 錯誤 spawn ENOENT 24 錯誤在 robofriends@0.0. 失敗腳本。 24 錯誤 這可能不是 npm 的問題。 上面可能有額外的日志輸出。 25 詳細退出 [ 1, true ]

我嘗試了這個解決方案,但它對我不起作用:

stackoverflow.com/a/42539669/5069226

創建反應應用程序運行

npm 開始失敗

看起來這與您的工作區路徑有關。

我嘗試使用路徑/tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React:Redux/robofriends在我的機器上復制它,並且我能夠重現您的錯誤。

╭─  /tmp/Users/Neil/Desktop/Complete Web Developer/Section 
18_React:Redux/robofriends 
╰ yarn start                                                                                                                                                                                                     K8S: tools    11:37:33
yarn run v1.7.0
$ react-scripts start
/bin/sh: react-scripts: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

但是當我將robofriends目錄移到樹中更高的位置時,它運行良好。

╭─  /tmp/Users/robofriends 
╰ yarn start                                                                                                                                                                                             K8S: tools  INT(-2) ↵  11:38:34
yarn run v1.7.0
Starting the development server...

我猜它可能是節點模塊的長路徑或路徑中的非字母字符, :_ 所以我回到React:Redux目錄並將其重命名為...React_Redux並在 /tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React_Redux/robofriends` 中再次嘗試npm start ,它工作得很好: )

所以看起來npm不喜歡:在可執行路徑中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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