【发布时间】:2017-07-08 05:18:24
【问题描述】:
我在海拔模式下运行 BoUoW 并安装了 @angular/cli 并使用新命令创建了一个示例项目。
当我尝试通过 npm start 运行应用程序时,它通过说明错误 ng serve failed 而失败,并将其归咎于 npm 和节点版本问题或应用程序本身。 npm 和 node 版本是最新的。
任何 angular 2 专家建议还是我使用了错误的样板应用程序?
编辑:
- @angular/cli: 1.0.0-beta.32.3
- 节点:6.9.5
- npm: 3.10.10
编辑 2:(错误日志)
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@4.1.2
3 info using node@v7.5.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle testapp@0.0.0~prestart: testapp@0.0.0
6 silly lifecycle testapp@0.0.0~prestart: no script for prestart, continuing
7 info lifecycle testapp@0.0.0~start: testapp@0.0.0
8 verbose lifecycle testapp@0.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle testapp@0.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/mnt/c/Users/sande/Desktop/testapp/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
10 verbose lifecycle testapp@0.0.0~start: CWD: /mnt/c/Users/sande/Desktop/testapp
11 silly lifecycle testapp@0.0.0~start: Args: [ '-c', 'ng serve' ]
12 silly lifecycle testapp@0.0.0~start: Returned: code: 1 signal: null
13 info lifecycle testapp@0.0.0~start: Failed to exec start script
14 verbose stack Error: testapp@0.0.0 start: `ng serve`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:192:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/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:192:7)
14 verbose stack at maybeClose (internal/child_process.js:890:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid testapp@0.0.0
16 verbose cwd /mnt/c/Users/sande/Desktop/testapp
17 error Linux 3.4.0+
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v7.5.0
20 error npm v4.1.2
21 error code ELIFECYCLE
22 error testapp@0.0.0 start: `ng serve`
22 error Exit status 1
23 error Failed at the testapp@0.0.0 start script 'ng serve'.
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 testapp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error ng serve
23 error You can get information on how to open an issue for this project with:
23 error npm bugs testapp
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls testapp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
编辑 3:重现步骤
注意我在 14393.693 / 14.04.5 LTS 上使用 BoUoW
sudo n v7.5.0
npm install -g @angular/cli
ng new my-project
cd my-project
npm start
【问题讨论】:
-
可以分享一下错误日志吗?
-
按要求添加了错误日志。对于 npm 6.5.0 的组合,我得到了同样的错误
-
令人担忧的是,它只有大约 5 行 bash 脚本就搞砸了。我在这里并没有真正做任何特别的事情。
-
你也可以分享你的 package.json 吗?