【发布时间】:2021-01-02 17:04:15
【问题描述】:
我遇到了一个错误,我对此几乎没有因果信息,但我会尽可能多地提供上下文。
我创建了一个简单的 React 应用程序,我的错误是我安装 node_modules 的客户端目录独有的。我的应用程序最近在 2 周前工作,但是当我运行命令“npm start”时,应用程序无法启动。我的终端中的 npm 生成的错误响应描述为:“npm ERR!在 mysomm-client@0.1.0 启动脚本失败。”
davidcarrillojr@Davids-MBP mysomm-client % npm start
> mysomm-client@0.1.0 start /Users/davidcarrillojr/Desktop/projects/mern_projects/MySomm/mysomm-client
> react-scripts start
Could not find a required file.
Name: index.html
Searched in: /Users/davidcarrillojr/Desktop/projects/mern_projects/MySomm/mysomm-client/public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mysomm-client@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mysomm-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! /Users/davidcarrillojr/.npm/_logs/2020-09-15T21_34_39_443Z-debug.log
davidcarrillojr@Davids-MBP mysomm-client %
调试日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.14.4
3 info using node@v14.0.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle mysomm-client@0.1.0~prestart: mysomm-client@0.1.0
6 info lifecycle mysomm-client@0.1.0~start: mysomm-client@0.1.0
7 verbose lifecycle mysomm-client@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle mysomm-client@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/davidcarrillojr/Desktop/projects/mern_projects/MySomm/mysomm-client/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle mysomm-client@0.1.0~start: CWD: /Users/davidcarrillojr/Desktop/projects/mern_projects/MySomm/mysomm-client
10 silly lifecycle mysomm-client@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle mysomm-client@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle mysomm-client@0.1.0~start: Failed to exec start script
13 verbose stack Error: mysomm-client@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1051:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid mysomm-client@0.1.0
15 verbose cwd /Users/davidcarrillojr/Desktop/projects/mern_projects/MySomm/mysomm-client
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v14.0.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error mysomm-client@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the mysomm-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 ]
终端响应表明它找不到文件“index.html”,但是自从我创建这个项目以来,我从未使用过 index.htm 文件。
自从项目最初创建以来,我没有更改任何目录或文件。自从应用程序上次成功运行大约两周前以来,我也没有更改任何前端代码或文件。
*这是我在 stackoverflow 上的第一篇文章,如果有人对发布最具描述性的问题有任何提示,请告诉我。
【问题讨论】: