Npm err!代码ELIFECYCE无法运行npm start

时间:2019-07-30 02:01:20

标签: node.js npm-install npm-start

我正在学习反应,我正在处理一个示例代码,我试图在运行 npm 安装并 npm 启动后使其正常工作,但是我收到以下错误

> live-server public/

Serving "public/" at http://127.0.0.1:8080
events.js:180
      throw er; // Unhandled 'error' event
      ^

Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: [ '/c', 'start', '""', '/b', 'http://127.0.0.1:8080' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! indecision-app@1.0.0 serve: `live-server public/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the indecision-app@1.0.0 serve 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:\ProgramData\nodejs\npm-cache\_logs\2019-07-30T01_47_19_860Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! indecision-app@1.0.0 start: `npm run serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the indecision-app@1.0.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:\ProgramData\nodejs\npm-cache\_logs\2019-07-30T01_47_20_054Z-debug.log

这是我的 package.json 文件

{
  "name": "indecision-app",
  "version": "1.0.0",
  "main": "index.js",
  "author": "hendrx",
  "license": "MIT",
  "scripts": {
    "start": "npm run serve",
    "serve": "live-server public/",
    "build": "webpack --watch",
    "build-babel": "babel src/app.js --out-file=public/bundle.js --presets=env,react --watch"
  },
  "dependencies": {
    "babel-cli": "6.24.1",
    "babel-preset-env": "1.5.2",
    "babel-preset-react": "6.24.1",
    "live-server": "^1.2.1",
    "webpack": "3.1.0"
  }
}

然后我检查了完整日志的路径,最终的完整日志如下:

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\\AKA\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.9.0
3 info using node@v12.6.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle indecision-app@1.0.0~prestart: indecision-app@1.0.0
6 info lifecycle indecision-app@1.0.0~start: indecision-app@1.0.0
7 verbose lifecycle indecision-app@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle indecision-app@1.0.0~start: PATH: C:\Users\AKA\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\AKA\Desktop\react-course-project\indecision-app\node_modules\.bin;C:\Users\AKA\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Ruby25-x64\bin;C:\ProgramData\chocolatey\bin;C:\WINDOWS\system3;.;C:\Program Files\MongoDB\Server\4.0\bin;C:\Program Files (x86)\Google\Chrome\Application;C:\Program Files\Mozilla Firefox;C:\Program Files\Git\cmd;C:\Program Files (x86)\Brackets\command;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin;C:\WINDOWS\system3;.;C:\Program Files\heroku\bin;C:\Program Files\MongoDB\Server\4.0\bin;C:\Users\AKA\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\AKA\AppData\Roaming\npm;C:\Users\AKA\AppData\Local\Yarn\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle indecision-app@1.0.0~start: CWD: C:\Users\AKA\Desktop\react-course-project\indecision-app
10 silly lifecycle indecision-app@1.0.0~start: Args: [ '/d /s /c', 'npm run serve' ]
11 silly lifecycle indecision-app@1.0.0~start: Returned: code: 1  signal: null
12 info lifecycle indecision-app@1.0.0~start: Failed to exec start script
13 verbose stack Error: indecision-app@1.0.0 start: `npm run serve`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\AKA\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:203:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\AKA\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:203: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 indecision-app@1.0.0
15 verbose cwd C:\Users\AKA\Desktop\react-course-project\indecision-app
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\AKA\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.6.0
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error indecision-app@1.0.0 start: `npm run serve`
22 error Exit status 1
23 error Failed at the indecision-app@1.0.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 ]

请大家帮我解决这个问题。

0 个答案:

没有答案