簡體   English   中英

無法啟動 React 項目

[英]Unable to launch React Project

請找到我在終端中得到的錯誤日志

fruits-vegetables@0.1.0 start C:\Users\MY PC\My_Front_End\fruits-vegetables
> react-scripts start
Could not find a required file.
  Name: index.html
  Searched in: C:\Users\MY PC\My_Front_End\fruits-vegetables\public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fruits-vegetables@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fruits-vegetables@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MY PC\AppData\Roaming\npm-cache\_logs\2019-12-20T15_57_41_927Z-debug.log

請查找調試錯誤日志

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\MY PC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.10.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle fruits-vegetables@0.1.0~prestart: fruits-vegetables@0.1.0
6 info lifecycle fruits-vegetables@0.1.0~start: fruits-vegetables@0.1.0
7 verbose lifecycle fruits-vegetables@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle fruits-vegetables@0.1.0~start: PATH: C:\Users\MY PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\MY PC\My_Front_End\fruits-vegetables\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Users\MY PC\AppData\Local\Microsoft\WindowsApps;C:\Users\MY PC\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\MY PC\AppData\Roaming\npm;C:\Program Files\Git\bin;C:\Program Files (x86)\Nmap
9 verbose lifecycle fruits-vegetables@0.1.0~start: CWD: C:\Users\MY PC\My_Front_End\fruits-vegetables
10 silly lifecycle fruits-vegetables@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle fruits-vegetables@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle fruits-vegetables@0.1.0~start: Failed to exec start script
13 verbose stack Error: fruits-vegetables@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\MY PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:209:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\MY PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:209:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid fruits-vegetables@0.1.0
15 verbose cwd C:\Users\MY PC\My_Front_End\fruits-vegetables
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\MY PC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.10.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error fruits-vegetables@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the fruits-vegetables@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

此外,我已經嘗試過這些建議:

  1. 刪除節點模塊package-lock.json
  2. 然后運行命令: npm update
  3. 然后運行命令: npm install
  4. 當我運行npm start時,我遇到了與上面相同的錯誤

我注意到的另一件事是,每當我新安裝一個 React 應用程序時,我都會得到 App.js、index.js、index.html 甚至一個 src 文件夾,但我沒有得到所有這些。 請幫忙!

我以前也遇到過這個問題,但幸運的是我永遠修復了它,您可以通過轉到 -> 控制面板 -> 系統和安全 -> 系統 -> 高級系統設置 -> 環境變量查找系統變量並查看對於 ComSpec 確保路徑是這樣的C:\\Windows\\system32\\cmd.exe並重新啟動系統,看看它會工作

暫無
暫無

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

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