我已经尝试了所有选项,将我的版本打字稿从“2.4.2”更改为“2.4.1”我还分别执行了“npm run serve”和“npm run build:watch”,但它不起作用。我已将环境设置为可变,但根本不起作用。请帮助解决这个问题。
运行 cmd npm start 时出现以下错误:
执行命令时发生错误:npm run serve
错误:spawn cmd.exe ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
执行命令时发生错误:npm run serve
Error: spawn cmd.exe ENOENT
at exports._errnoException (util.js:1018:11)`enter code here`
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
[1] npm run serve exited with code -4058
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-quickstart@1.0.0 start: `concurrently "npm run build:watch"
"npm run serve"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart@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:\Users\Nitesh Sharma\AppData\Roaming\npm-cache\_logs\2017-08-04T05_49_43_912Z-debug.log
这是我的 package.json 文件:
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented
with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@types/jasmine": "2.5.36",
"@types/node": "^6.0.46",
"canonical-path": "0.0.2",
"concurrently": "^3.2.0",
"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",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"tslint": "^3.15.1",
"typescript": "^2.4.2"
},
"repository": {}
}
我的调试日志是:
0 info it worked if it ends with ok
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' ]
2 info using npm@3.10.10
3 info using node@v6.11.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular-quickstart@1.0.0~prestart: angular-quickstart@1.0.0
6 verbose lifecycle angular-quickstart@1.0.0~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle angular-quickstart@1.0.0~prestart: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master\node_modules\.bin;C:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Nitesh Sharma\AppData\Roaming\npm
8 verbose lifecycle angular-quickstart@1.0.0~prestart: CWD: C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master
9 silly lifecycle angular-quickstart@1.0.0~prestart: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle angular-quickstart@1.0.0~prestart: Returned: code: 0 signal: null
11 info lifecycle angular-quickstart@1.0.0~start: angular-quickstart@1.0.0
12 verbose lifecycle angular-quickstart@1.0.0~start: unsafe-perm in lifecycle true
13 verbose lifecycle angular-quickstart@1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master\node_modules\.bin;C:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Nitesh Sharma\AppData\Roaming\npm
14 verbose lifecycle angular-quickstart@1.0.0~start: CWD: C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master
15 silly lifecycle angular-quickstart@1.0.0~start: Args: [ '/d /s /c',
15 silly lifecycle 'concurrently "npm run build:watch" "npm run serve"' ]
16 silly lifecycle angular-quickstart@1.0.0~start: Returned: code: 1 signal: null
17 info lifecycle angular-quickstart@1.0.0~start: Failed to exec start script
18 verbose stack Error: angular-quickstart@1.0.0 start: `concurrently "npm run build:watch" "npm run serve"`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at EventEmitter.emit (events.js:191:7)
18 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at ChildProcess.emit (events.js:191:7)
18 verbose stack at maybeClose (internal/child_process.js:891:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
19 verbose pkgid angular-quickstart@1.0.0
20 verbose cwd C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master
21 error Windows_NT 6.1.7601
22 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
23 error node v6.11.1
24 error npm v3.10.10
25 error code ELIFECYCLE
26 error angular-quickstart@1.0.0 start: `concurrently "npm run build:watch" "npm run serve"`
26 error Exit status 1
27 error Failed at the angular-quickstart@1.0.0 start script 'concurrently "npm run build:watch" "npm run serve"'.
27 error Make sure you have the latest version of node.js and npm installed.
27 error If you do, this is most likely a problem with the angular-quickstart package,
27 error not with npm itself.
27 error Tell the author that this fails on your system:
27 error concurrently "npm run build:watch" "npm run serve"
27 error You can get information on how to open an issue for this project with:
27 error npm bugs angular-quickstart
27 error Or if that isn't available, you can get their info via:
27 error npm owner ls angular-quickstart
27 error There is likely additional logging output above.
28 verbose exit [ 1, true ]