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

Angular 2 QuickStart实时服务器错误

如何解决《Angular2QuickStart实时服务器错误》经验,为你挑选了3个好方法。

我是棱角分明的新手,我一直在努力学习更多关于angular2的信息.我按照入门指南创建了angular2-quickstart项目.但是当我运行命令npm start时,浏览器启动但是1秒后一切都失败了.以下是我的npm错误日志文件的内容:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'lite' ]
2 info using npm@3.3.12
3 info using node@v5.2.0
4 verbose run-script [ 'prelite', 'lite', 'postlite' ]
5 info lifecycle angular2-quickstart@1.0.0~prelite: angular2-quickstart@1.0.0
6 silly lifecycle angular2-quickstart@1.0.0~prelite: no script for prelite, continuing
7 info lifecycle angular2-quickstart@1.0.0~lite: angular2-quickstart@1.0.0
8 verbose lifecycle angular2-quickstart@1.0.0~lite: unsafe-perm in lifecycle true
9 verbose lifecycle angular2-quickstart@1.0.0~lite: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/bakary/angular2-quickstart/node_modules/.bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/bakary/angular2-quickstart/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle angular2-quickstart@1.0.0~lite: CWD: /home/bakary/angular2-quickstart
11 silly lifecycle angular2-quickstart@1.0.0~lite: Args: [ '-c', 'lite-server' ]
12 silly lifecycle angular2-quickstart@1.0.0~lite: Returned: code: 1  signal: null
13 info lifecycle angular2-quickstart@1.0.0~lite: Failed to exec lite script
14 verbose stack Error: angular2-quickstart@1.0.0 lite: `lite-server`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack     at emitTwo (events.js:88:13)
14 verbose stack     at EventEmitter.emit (events.js:173:7)
14 verbose stack     at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:88:13)
14 verbose stack     at ChildProcess.emit (events.js:173:7)
14 verbose stack     at maybeClose (internal/child_process.js:819:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:212:5)
15 verbose pkgid angular2-quickstart@1.0.0
16 verbose cwd /home/bakary/angular2-quickstart
17 error Linux 3.16.0-50-generic
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lite"
19 error node v5.2.0
20 error npm  v3.3.12
21 error code ELIFECYCLE
22 error angular2-quickstart@1.0.0 lite: `lite-server`
22 error Exit status 1
23 error Failed at the angular2-quickstart@1.0.0 lite script 'lite-server'.
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 angular2-quickstart package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     lite-server
23 error You can get their info via:
23 error     npm owner ls angular2-quickstart
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

你能帮我搞清楚我做错了什么吗?

问候



1> Ignatius And..:

更改Package.json脚本设置

"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\",

"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",

angular 2已经从系统js移动到webpack,找到你可以开始使用angular2 + webpack + Typescript的示例应用程序https://github.com/IgnatiusAndrew/angular2-webpack-starter


如上所述,这不是一个解决方法,TSC失败,因为您的代码中存在问题.在我的情况下,这是由于导入,我忘了在子文件夹中移动一些dataobject类文件后更改.

2> ssuperczynsk..:

解决方案是添加此行 /etc/sysctl.conf

fs.inotify.max_user_watches = 524288 

并在控制台中输入 sudo sysctl -p


@ Shakee93 ....它的时间去linux ...:P ....现在更好然后永远= D

3> tt_Gantz..:

很多人说tscpackage.json开始脚本中删除帮助他们.在这种情况下,问题是打字稿在代码中发现问题.

尝试tsc从终端运行,看看输出是什么并修复它.如果问题是tsc然后修复,则应删除错误.

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