我是编程和React的新手。我正在尝试启动我的项目,但是没有启动。 这是错误:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@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\Home\AppData\Roaming\npm-cache\_logs\2020-08-10T04_38_38_989Z-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:\\Program Files\\nodejs\\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.16.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle client@0.1.0~prestart: client@0.1.0
6 info lifecycle client@0.1.0~start: client@0.1.0
7 verbose lifecycle client@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle client@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\ReactProjects\restaurant-app\client\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\WINDOWS\System32\OpenSSH\;C:\WINDOWS\SysWOW64;C:\Program Files\wget;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\Home\AppData\Local\Microsoft\WindowsApps;C:\Users\Home\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Home\AppData\Roaming\npm;C:\Users\Home\AppData\Local\GitHubDesktop\bin
9 verbose lifecycle client@0.1.0~start: CWD: D:\ReactProjects\restaurant-app\client
10 silly lifecycle client@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle client@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle client@0.1.0~start: Failed to exec start script
13 verbose stack Error: client@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:321:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:321:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid client@0.1.0
15 verbose cwd D:\ReactProjects\restaurant-app\client
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.16.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error client@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the client@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 ]
P.S。我尝试清理缓存,删除node_modules和package-lock.json并重新安装它们,但是并不能解决我的问题。
预先感谢
答案 0 :(得分:0)
也许,您可以尝试删除node_modules并使用命令'npm install'或'yarn'重新安装所有它们。
答案 1 :(得分:0)
使用引导程序的 CDN 链接。 开始使用the docs
答案 2 :(得分:0)
我修复了它。对不起,我很愚蠢。我只是将“公用”文件夹移到了组件中。 移至根文件夹并启动项目。
答案 3 :(得分:0)
我确实有同样的问题,但我不得不删除 package-lock.json 然后 node_modules 文件夹和问题立即消失
但记得检查缓存是否被清理或通过强制清理它 像这样
npm cache clean --force
再次运行npm install
命令以重新安装正确删除的模块
快乐编码@Ykee