Npm run start返回错误

时间:2017-01-25 09:48:10

标签: javascript node.js angular npm

嘿伙计们,

我正在学习基本的angularjs 2.0技能的教程。在我的情况下

npm run start

没用。我在Windows 10操作系统上使用当前版本的git bash。 node@v6.9.4 npm@3.10.10

这是我的package.json的内容:

{
  "name": "app",
  "version": "0.0.1",
  "description": "Angular 2.0 Setup auf Basis von node js und system js",
  "main": "index.js",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
    "test": "echo \"Error: no test specified\" && exit 1",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings",
    "lite": "lite-server"
  },
  "keywords": [
    "Angular",
    "2.0",
    "Setup"
  ],
  "author": "Martin Piontek",
  "license": "ISC",
  "devDependencies": {
    "concurrently": "^3.1.0",
    "lite-server": "^2.2.2",
    "typescript": "^2.1.5",
    "typings": "^2.1.0"
  },
  "dependencies": {
    "@angular/common": "^2.4.4",
    "@angular/compiler": "^2.4.4",
    "@angular/core": "^2.4.4",
    "@angular/http": "^2.4.4",
    "@angular/platform-browser": "^2.4.4",
    "@angular/platform-browser-dynamic": "^2.4.4",
    "@angular/router": "^3.4.4",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.9",
    "rxjs": "^5.0.3",
    "systemjs": "^0.20.0",
    "zone.js": "^0.7.6"
  }
}

这是npm-debug.log

的内容
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   'run',
1 verbose cli   'start' ]
2 info using npm@3.10.10
3 info using node@v6.9.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle app@0.0.1~prestart: app@0.0.1
6 silly lifecycle app@0.0.1~prestart: no script for prestart, continuing
7 info lifecycle app@0.0.1~start: app@0.0.1
8 verbose lifecycle app@0.0.1~start: unsafe-perm in lifecycle true
9 verbose lifecycle app@0.0.1~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\.bin;C:\Users\mpion\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\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\mpion\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Users\mpion\AppData\Local\Microsoft\WindowsApps;C:\Users\mpion\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle app@0.0.1~start: CWD: C:\Users\mpion\Desktop\angulartraining\0000\setup
11 silly lifecycle app@0.0.1~start: Args: [ '/d /s /c',
11 silly lifecycle   'tsc && concurrently "npm run tsc:w" "npm run lite"' ]
12 silly lifecycle app@0.0.1~start: Returned: code: 1  signal: null
13 info lifecycle app@0.0.1~start: Failed to exec start script
14 verbose stack Error: app@0.0.1 start: `tsc && concurrently "npm run tsc:w" "npm run lite"`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid app@0.0.1
16 verbose cwd C:\Users\mpion\Desktop\angulartraining\0000\setup
17 error Windows_NT 10.0.14393
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
19 error node v6.9.4
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error app@0.0.1 start: `tsc && concurrently "npm run tsc:w" "npm run lite"`
22 error Exit status 1
23 error Failed at the app@0.0.1 start script 'tsc && concurrently "npm run tsc:w" "npm run lite"'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the app package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     tsc && concurrently "npm run tsc:w" "npm run lite"
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs app
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls app
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

我希望有可能向我提供有用的信息。如果您需要更多信息,请随时问我。

tsconfig.json的内容 - 文件

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": false,
        "sourceMap": true,
        "moduleResolutions": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false
    }
}

在tsconfig.json中调试我的拼写错误后,我有了这个输出:

对此我很抱歉!看起来我更进了一步,但现在运行npm run start后出现了另一个错误:

 Error occured when executing command: npm run tsc:w
 Error: Unable to detect platform shell type. Please set SHELL_EXECUTE_FLAG env variable.
     at detectExecuteFlag (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\spawn-default-shell\src\get-shell.js:29:9)
     at getShell (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\spawn-default-shell\src\get-shell.js:37:18)
     at Object.spawn (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\spawn-default-shell\src\index.js:5:24)
     at C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\concurrently\src\main.js:192:34
     at arrayMap (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\lodash\lodash.js:660:23)
     at Function.map (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\lodash\lodash.js:9571:14)
     at run (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\concurrently\src\main.js:181:22)
     at main (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\concurrently\src\main.js:61:5)
     at Object.<anonymous> (C:\Users\mpion\Desktop\angulartraining\0000\setup\node_modules\concurrently\src\main.js:421:1)
     at Module._compile (module.js:570:32)
     at Object.Module._extensions..js (module.js:579:10)
     at Module.load (module.js:487:32)
     at tryModuleLoad (module.js:446:12)
     at Function.Module._load (module.js:438:3)
     at Module.runMain (module.js:604:10)
     at run (bootstrap_node.js:394:7)

1 个答案:

答案 0 :(得分:1)

tsconfig.json内有拼写错误。

moduleResolutions更改为moduleResolution