当前位置:  开发笔记 > 编程语言 > 正文

运行npm以Angular2 quickstart开始导致错误(lite-server?)

如何解决《运行npm以Angular2quickstart开始导致错误(lite-server?)》经验,为你挑选了1个好方法。

使用Angular2无法越过起跑线...出于某种原因,我无法运行lite-server,因为有......

最有可能是angular-quickstart包的问题

当我跑步时,npm start我得到:

> angular-quickstart@1.0.0 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. (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! angular-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-server" `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 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

这是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   'start' ]
2 info using npm@2.15.8
3 info using node@v4.4.7
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart angular-quickstart@1.0.0
6 info start angular-quickstart@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info angular-quickstart@1.0.0 Failed to exec start script
9 verbose stack Error: angular-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-server" `
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter. (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. (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 angular-quickstart@1.0.0
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 angular-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-server" `
17 error Exit status 1
18 error Failed at the angular-quickstart@1.0.0 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 ]

这个东西不容易!



1> 小智..:

当我尝试从git bash从角度2站点启动快速入门回购时,我遇到了类似的问题.

我找到的解决方案是:

1.)更新你的SHELL env变量导出SHELL ="/ c/Program Files/Git/bin/bash"

2.)从Quickstart仓库导航到node_module/spawn-default-shell/src/get-shell.js.打开get-shell.js并进行以下更改:

const DETECT_SH_REGEX =/sh $ /;

const DETECT_SH_REGEX =/sh /;

完整的解释可以在github上的以下问题页面找到:https: //github.com/angular/quickstart/issues/359

推荐阅读
有风吹过best
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有