ELIFECYCLE Node.js出错,这有多正确?

时间:2017-08-24 03:42:20

标签: javascript node.js angular

我用版本2.1.2(我按照教程)学习Angular2,但是当我做NPM启动时出现问题 问题出在以下版本:2.1.2 - 2.3.0 - 2.4.0。 (版本:4可以正常工作)

主要错误是:错误!代码ELIFECYCLE

有什么想法吗?谢谢

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\tartines\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@5.3.0
3 info using node@v6.11.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular-quickstart@1.0.0~prestart: angular-quickstart@1.0.0
6 info lifecycle angular-quickstart@1.0.0~start: angular-quickstart@1.0.0
7 verbose lifecycle angular-quickstart@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle angular-quickstart@1.0.0~start: PATH: C:\Users\tartines\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\tartines\angular2\ngrando240\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\tartines\AppData\Roaming\npm
9 verbose lifecycle angular-quickstart@1.0.0~start: CWD: C:\Users\tartines\angular2\ngrando240
10 silly lifecycle angular-quickstart@1.0.0~start: Args: [ '/d /s /c', 'tsc && concurrently "tsc -w" "lite-server" ' ]
11 silly lifecycle angular-quickstart@1.0.0~start: Returned: code: 2  signal: null
12 info lifecycle angular-quickstart@1.0.0~start: Failed to exec start script
13 verbose stack Error: angular-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-server" `
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\tartines\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:289:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at EventEmitter.emit (events.js:191:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\tartines\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:891:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid angular-quickstart@1.0.0
15 verbose cwd C:\Users\tartines\angular2\ngrando240
16 verbose Windows_NT 6.2.9200
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\tartines\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v6.11.2
19 verbose npm  v5.3.0
20 error code ELIFECYCLE
21 error errno 2
22 error angular-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-server" `
22 error Exit status 2
23 error Failed at the angular-quickstart@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 [ 2, true ]

这是关于我的角度2项目的文件package.json

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
    "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
    "lint": "tslint ./app/**/*.ts -t verbose",
    "lite": "lite-server",
    "pree2e": "webdriver-manager update",
    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
    "test-once": "tsc && karma start karma.conf.js --single-run",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/common": "~2.4.0",
    "@angular/compiler": "~2.4.0",
    "@angular/core": "~2.4.0",
    "@angular/forms": "~2.4.0",
    "@angular/http": "~2.4.0",
    "@angular/platform-browser": "~2.4.0",
    "@angular/platform-browser-dynamic": "~2.4.0",
    "@angular/router": "~3.4.0",
    "angular-in-memory-web-api": "~0.2.1",
    "systemjs": "0.19.40",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.1",
    "zone.js": "^0.7.4"
  },
  "devDependencies": {
    "concurrently": "^3.1.0",
    "lite-server": "^2.2.2",
    "typescript": "~2.0.10",
    "canonical-path": "0.0.2",
    "http-server": "^0.9.0",
    "tslint": "^3.15.1",
    "lodash": "^4.16.4",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~4.0.13",
    "rimraf": "^2.5.4",
    "@types/node": "^6.0.46",
    "@types/jasmine": "^2.5.36",
    "@types/selenium-webdriver": "2.53.33"
  },
  "repository": {}
}

1 个答案:

答案 0 :(得分:0)

有两种可能的方式:

1)通过执行命令单独运行lite服务器:

npm run lite

2)在脚本中修改start命令:

将现有的开头替换为以下内容:

"start": "concurrently \"npm run tsc:w\" \"npm run lite\" "