npm ERR!在mysomm-client@0.1.0启动脚本处失败

时间:2020-09-15 21:50:47

标签: reactjs npm

我遇到了一个因果关系信息很少的错误,但是我将提供尽可能多的上下文。

我创建了一个简单的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的第一篇文章,如果有人对发布最具描述性的问题有任何提示,请告诉我。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。

公共目录及其“ index.html”文件已移至另一个目录,因此当react-script start运行时,如果不再次复制public / index.html,它将无法完成脚本。实际上,我能够跟踪我的github回购树以获取放错位置文件的副本。