简体   繁体   中英

Npm run start returns error

Heys guys,

i am following a tutorial to learning basic angularjs 2.0 skills. In my case

npm run start

did not work. I am using git bash in current version on a windows 10 os. node@v6.9.4 npm@3.10.10

Here is the content of my 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"
  }
}

And here is the content of the 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 ]

I hope it is possible to give me useful information how to go on. If you need some more information, feel free to ask me.

Content of the tsconfig.json - File

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

After debugging my typo in tsconfig.json i have this output:

I am so sorry for this! It seems like i am one step further, but now there is another Error after running the 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)

You have typo inside tsconfig.json .

Change moduleResolutions to moduleResolution .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM