DanWahlin / Angular-JumpStart

Angular and TypeScript JumpStart example application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to npm start

tdungnguyen opened this issue · comments

I run into this issue after npm install and start the project. Please help!
p/s; I am quite new to Angular, please excuse me if I asked a silly question.

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.0.5
3 info using node@v6.9.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular2-jumpstart@1.0.0prestart: angular2-jumpstart@1.0.0
6 silly lifecycle angular2-jumpstart@1.0.0
prestart: no script for prestart, continuing
7 info lifecycle angular2-jumpstart@1.0.0start: angular2-jumpstart@1.0.0
8 verbose lifecycle angular2-jumpstart@1.0.0
start: unsafe-perm in lifecycle true
9 verbose lifecycle angular2-jumpstart@1.0.0start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/dungnt/Angular-JumpStart-master/node_modules/.bin:usr/local/bin:/usr/local/ant/bin:/home/dungnt/Downloads/jdk1.8.0_111/bin:usr/local/bin:/usr/local/ant/bin:/home/dungnt/Downloads/jdk1.8.0_111/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/dungnt/opt/gradle/bin:/home/dungnt/opt/gradle/bin
10 verbose lifecycle angular2-jumpstart@1.0.0
start: CWD: /home/dungnt/Angular-JumpStart-master
11 silly lifecycle angular2-jumpstart@1.0.0start: Args: [ '-c', 'tsc && concurrently "tsc -w" "node server.js" ' ]
12 silly lifecycle angular2-jumpstart@1.0.0
start: Returned: code: 2 signal: null
13 info lifecycle angular2-jumpstart@1.0.0~start: Failed to exec start script
14 verbose stack Error: angular2-jumpstart@1.0.0 start: tsc && concurrently "tsc -w" "node server.js"
14 verbose stack Exit status 2
14 verbose stack at EventEmitter. (/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:191:7)
14 verbose stack at ChildProcess. (/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: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 angular2-jumpstart@1.0.0
16 verbose cwd /home/dungnt/Angular-JumpStart-master
17 error Linux 3.13.0-37-generic
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v6.9.3
20 error npm v4.0.5
21 error code ELIFECYCLE
22 error angular2-jumpstart@1.0.0 start: tsc && concurrently "tsc -w" "node server.js"
22 error Exit status 2
23 error Failed at the angular2-jumpstart@1.0.0 start script 'tsc && concurrently "tsc -w" "node server.js" '.
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-jumpstart package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error tsc && concurrently "tsc -w" "node server.js"
23 error You can get information on how to open an issue for this project with:
23 error npm bugs angular2-jumpstart
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls angular2-jumpstart
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Sorry you're running into an issue. I just ran the latest build on both Mac and Windows without any issues so I'm not sure what the problem may be there. I'd recommend re-extracting the code (make sure you have the latest) and running npm install and npm start again.

I haven't seen this particular error (and as mentioned can't duplicate it) so I can only guess that npm install may not have installed everything correctly. If you're running it on Linux I don't have a way to test that unfortunately right now but Mac and Windows seem to be working correctly.

@DanWahlin thank you Mr. Wahlin! I'll try the way you recommended

@DanWahlin It seems that I found the root cause of this issue: fsevents does not support for npm on Linux environment. Since you mentioned that you ran the build on Mac and Windows only, I guess that without fsevents the project can not be started with npm start command.
I suggest that you should put a short notice of possible OS deployment

Thanks for the info. I don't run Linux so I can't support that unfortunately (or even try it). Here's what I'd recommend:

Run the following commands in separate command windows:

  1. npm run tsc:w
  2. node server.js

I'm guessing the concurrently module may be the problem on Linux. Try running the commands separately and let me know if that works for you. The JumpStart app is using the same setup as the Angular docs recommend so I'm guessing their demos may have a problem on Linux as well.

I just realized that several of my other projects using Docker (on Linux) have the same general setup and they're working OK so I suspect something else is going on. They use the exact same npm start command that uses concurrently to run tsc:w and node server.js. Here's an example:

https://github.com/DanWahlin/Angular-RESTfulService

I don't have a way to run this particular project on Linux right now (without creating a Docker environment anyway) but I have several others that are more involved that seem to be working OK. I'm not sure that fsevents is the problem actually (especially since you'll see warnings about that module on Mac and Windows as well).

@DanWahlin Wow! Like you did recommended me to run both commands. At first, I was able to run localhost on port 3000 but nothing came up. I tried to re-run node server.js several times while keeping command npm run tsc:w running, and it works.
In here I just deploy a demo on so I did skipped Docker in this case. I guess that I have to learn more.
Thank you very much!
p/s: I immediately regret my conclusion about fsevents

No problem - I've seen that fsevents error as well and it definitely makes it feel like it's the main problem sometimes when it isn't. Glad you got it going. I'm not sure why the concurrently module isn't working for you since I have it working in other scenarios with Docker/Linux, but if you have it going now by running separate commands that's great.