Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running npm start with Angular2 quickstart results in error (lite-server?)

Having trouble getting past the starting line here with Angular2... for some reason I can't run the lite-server because there is...

most likely a problem with the angular-quickstart package

When I run npm start I get:

> [email protected] start C:\xampp\htdocs\js\angular2\quickstart
> tsc && concurrently "tsc -w" "lite-server"

 Error occured when executing command: tsc -w
 Error: Unable to detect platform shell type. Please set SHELL_EXECUTE_FLAG env variable.
     at detectExecuteFlag (C:\xampp\htdocs\js\angular2\quickstart\node_modules\concurrently\node_modules\spawn-default-shell\src\get-shell.js:29:9)
     at getShell (C:\xampp\htdocs\js\angular2\quickstart\node_modules\concurrently\node_modules\spawn-default-shell\src\get-shell.js:37:18)
     at Object.spawn (C:\xampp\htdocs\js\angular2\quickstart\node_modules\concurrently\node_modules\spawn-default-shell\src\index.js:5:24)
     at C:\xampp\htdocs\js\angular2\quickstart\node_modules\concurrently\src\main.js:192:34
     at arrayMap (C:\xampp\htdocs\js\angular2\quickstart\node_modules\lodash\lodash.js:660:23)
     at Function.map (C:\xampp\htdocs\js\angular2\quickstart\node_modules\lodash\lodash.js:9571:14)
     at run (C:\xampp\htdocs\js\angular2\quickstart\node_modules\concurrently\src\main.js:181:22)
     at main (C:\xampp\htdocs\js\angular2\quickstart\node_modules\concurrently\src\main.js:61:5)
     at Object.<anonymous> (C:\xampp\htdocs\js\angular2\quickstart\node_modules\concurrently\src\main.js:421:1)
     at Module._compile (module.js:409:26)
     at Object.Module._extensions..js (module.js:416:10)
     at Module.load (module.js:343:32)
     at Function.Module._load (module.js:300:12)
     at Function.Module.runMain (module.js:441:10)
     at startup (node.js:139:18)
     at node.js:968:3

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `tsc && concurrently "tsc -w" "lite-server" `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'tsc && concurrently "tsc -w" "lite-server" '.
npm ERR! This is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && concurrently "tsc -w" "lite-server"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\xampp\htdocs\js\angular2\quickstart\npm-debug.log

And here is the npm_debug.log file

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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: `tsc && concurrently "tsc -w" "lite-server" `
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:827:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd C:\xampp\htdocs\js\angular2\quickstart
12 error Windows_NT 10.0.14393
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.7
15 error npm  v2.15.8
16 error code ELIFECYCLE
17 error [email protected] start: `tsc && concurrently "tsc -w" "lite-server" `
17 error Exit status 1
18 error Failed at the [email protected] start script 'tsc && concurrently "tsc -w" "lite-server" '.
18 error This is most likely a problem with the angular-quickstart package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     tsc && concurrently "tsc -w" "lite-server"
18 error You can get information on how to open an issue for this project with:
18 error     npm bugs angular-quickstart
18 error Or if that isn't available, you can get their info via:
18 error
18 error     npm owner ls angular-quickstart
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

This stuff is not easy!

like image 846
Jethro Hazelhurst Avatar asked Jan 22 '17 16:01

Jethro Hazelhurst


2 Answers

A similar problem happened to me when I tried to npm start the Quickstart repo from angular 2 site from git bash.

The solution that I have found is to:

1.) Update your SHELL env variable export SHELL="/c/Program Files/Git/bin/bash"

2.) Navigate to node_module/spawn-default-shell/src/get-shell.js from the Quickstart repo. Open up get-shell.js and do the following change:

const DETECT_SH_REGEX = /sh$/;

to

const DETECT_SH_REGEX = /sh/;

The full explanation can be found from the following issue page on github: https://github.com/angular/quickstart/issues/359

like image 177
Jason Liu Avatar answered Oct 08 '22 17:10

Jason Liu


Anyone having this problem and is using windows git bash, try using windows CLI.

like image 40
Jethro Hazelhurst Avatar answered Oct 08 '22 17:10

Jethro Hazelhurst