3

Just to clarify this: I'm completely new to AngularJS and to any Web Technology. I'm a beginner when it comes to Web Development.

I tried to install it and I've gotta admit, after many "Unknown Buttons Pressings", I may have done a big mess, or maybe not.

I followed AngularJS Website's Tutorial to install Angular and then I just wanted to push the "Red Button":

npm start

But it threw an error saying:

Angular JS - npm start/ng serve Error


Actual Debug_Log here:

0 info it worked if it ends with ok
1 verbose cli [ '/home/apanpie/.nvm/versions/node/v7.4.0/bin/node',
1 verbose cli   '/home/apanpie/.nvm/versions/node/v7.4.0/bin/npm',
1 verbose cli   'start' ]
2 info using npm@4.0.5
3 info using node@v7.4.0
4 verbose config Skipping project config: /home/apanpie/.npmrc. (matches userconfig)
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info lifecycle apanpie@0.0.0~prestart: apanpie@0.0.0
7 silly lifecycle apanpie@0.0.0~prestart: no script for prestart, continuing
8 info lifecycle apanpie@0.0.0~start: apanpie@0.0.0
9 verbose lifecycle apanpie@0.0.0~start: unsafe-perm in lifecycle true
10 verbose lifecycle apanpie@0.0.0~start: PATH: /home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/bin/node-gyp-bin:/home/apanpie/node_modules/.bin:/home/apanpie/.nvm/versions/node/v7.4.0/bin:/home/apanpie/bin:/home/apanpie/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
11 verbose lifecycle apanpie@0.0.0~start: CWD: /home/apanpie
12 silly lifecycle apanpie@0.0.0~start: Args: [ '-c', 'ng serve' ]
13 silly lifecycle apanpie@0.0.0~start: Returned: code: 1  signal: null
14 info lifecycle apanpie@0.0.0~start: Failed to exec start script
15 verbose stack Error: apanpie@0.0.0 start: `ng serve`
15 verbose stack Exit status 1
15 verbose stack     at EventEmitter.<anonymous> (/home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
15 verbose stack     at emitTwo (events.js:106:13)
15 verbose stack     at EventEmitter.emit (events.js:191:7)
15 verbose stack     at ChildProcess.<anonymous> (/home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
15 verbose stack     at emitTwo (events.js:106:13)
15 verbose stack     at ChildProcess.emit (events.js:191:7)
15 verbose stack     at maybeClose (internal/child_process.js:885:16)
15 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
16 verbose pkgid apanpie@0.0.0
17 verbose cwd /home/apanpie/Desktop/angularTest
18 error Linux 4.4.0-59-generic
19 error argv "/home/apanpie/.nvm/versions/node/v7.4.0/bin/node" "/home/apanpie/.nvm/versions/node/v7.4.0/bin/npm" "start"
20 error node v7.4.0
21 error npm  v4.0.5
22 error code ELIFECYCLE
23 error apanpie@0.0.0 start: `ng serve`
23 error Exit status 1
24 error Failed at the apanpie@0.0.0 start script 'ng serve'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the apanpie package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error     ng serve
24 error You can get information on how to open an issue for this project with:
24 error     npm bugs apanpie
24 error Or if that isn't available, you can get their info via:
24 error     npm owner ls apanpie
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]

So I've searched all around the Google Globe, but found nothing.

Also, I don't know if this is related, but in my TypeScript code:

import { View, Component } from '@angular2/core';
[... Components Here ... ]

it throws an error:

Cannot find module '@angular2/core'

If anyone could enlighten me, that would make me so happy!

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Eksapsy
  • 1,541
  • 3
  • 18
  • 26
  • can you show your app.component.html and .ts please – Yashveer Singh Jan 22 '17 at 14:19
  • I can show you the main.ts : https://gist.github.com/anonymous/46a1d0297c2bab13bb0a1616b47e8d35 But 1. I don't know what you mean by "app.component.html" and 2. Don't know if this is related because this happens even if I have an empty folder (Which I don't know if it makes me sound stupid, as I said I'm a beginner my friend and Angular's Tutorial didn't clarify many things to me) – Eksapsy Jan 22 '17 at 14:25
  • please share complete code it wil be helpfull to identify the issue . one question . did you npm install run without any error ? – Yashveer Singh Jan 22 '17 at 14:27
  • **npm install :** https://gist.github.com/anonymous/ce76295bec3639efd26795e33612cc19 **index.html :** https://gist.github.com/anonymous/c1c06a075f6fb36bcbfc72add88fa8f0 – Eksapsy Jan 22 '17 at 14:31
  • please check my answer I hope it will help you . – Yashveer Singh Jan 22 '17 at 14:35

3 Answers3

1

if you are just starting angular 2 then please follow these steps as mention on the website of angular .

1 download the starter project from here . save it t to local folder lets say c:\test\ . location = https://github.com/angular/quickstart.git quickstart this is all you need to do for hellp world app .

2) go to command prompt then cd c:\test . 3) please insatll node js if not installed . 4) npm install 5) npm start

This will show b your first angular 2 hello world app .

this site is best to learn for angular 2 . https://angular.io/docs/ts/latest/guide/setup.html

Yashveer Singh
  • 1,914
  • 2
  • 15
  • 23
  • Hey thanks, I see now. I just didn't have some required files. But could you tell me which files are required before I make an "npm start" to run a local server? Also, do they need extra configurations? If you're comfortable with this of course ! – Eksapsy Jan 22 '17 at 14:46
  • 1
    it is mentioned in package.json file . So in short you need to tell what files /packages you need for your application and you can add them in package.json file . All packages oon which application depends and for development you need are mentioned here . – Yashveer Singh Jan 22 '17 at 15:04
1

The versions of node/npm and angular/cli may not match. Look at this list Check list find your Angular version and check the node/npm version you are using.

WildHorse
  • 99
  • 1
  • 8
0

its a bit weird, but the root folder should be named like in this pattern, my-app, tour-of-heroes.

earlier today i had this problem, wrongly copied my-app like this: sudo cp -rv my-app tourOfHeroes then ran npm start inside tourOfHeroes got that error

then after a few hours decided to do: sudo cp -rv my-app tour-of-heroes then ran npm start inside tour-of-heroes then like magic it ran and im back in business