DoubleVoid
DoubleVoid

Reputation: 795

Angular, can't run sample project

I am trying to learn Angular and bought a book. The example code doesn't run though. I got the Angular quickstart project running, but not this on. Maybe some one can help.

This ist the error message I get when running npm start:

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 v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script 'tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the blog-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs blog-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls blog-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\angular\kickstart\blog-start\npm-debug.log

And this is my package.json:

{
  "name": "blog-app",
  "version": "1.0.0",
  "description": "Blog Applikation",
  "watch": {
    "copy:html": "./app/**/*.html"
  },
  "scripts": {
    "start": "tsc && npm run copy:html && concurrently \"npm run tsc:w\" \"npm run html:watch\" \"live-server\" ",
    "tsc": "./node_modules/.bin/tsc",
    "tsc:w": "./node_modules/.bin/tsc --watch",
    "copy:html": "copyfiles -u 1 ./app/**/*.html dist",
    "html:watch": "onchange \"./app/**/*.html\" -v -- npm run copy:html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@angular/common": ">=4.0.0-beta <5.0.0",
    "@angular/compiler": ">=4.0.0-beta <5.0.0",
    "@angular/core": ">=4.0.0-beta <5.0.0",
    "@angular/forms": ">=4.0.0-beta <5.0.0",
    "@angular/http": ">=4.0.0-beta <5.0.0",
    "@angular/platform-browser": ">=4.0.0-beta <5.0.0",
    "@angular/platform-browser-dynamic": ">=4.0.0-beta <5.0.0",
    "systemjs": "0.19.27",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.1.0",
    "zone.js": "^0.8.4",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "canonical-path": "0.0.2",
    "concurrently": "^2.2.0",
    "copyfiles": "^1.0.0",
    "http-server": "^0.9.0",
    "live-server": "^1.1.0",
    "lodash": "^4.11.1",
    "npm-watch": "^0.1.6",
    "onchange": "^3.0.2",
    "rimraf": "^2.5.2",
    "tslint": "^3.7.4",
    "typescript": "^2.0.2",
    "typings": "^1.0.4"
  },
  "repository": {}
}

I tried some solution from Stackoverflow posts (like changing the start script but it didn't help.)

EDIT: Tried updating NPM, didn't help:

PS E:\angular\kickstart\blog-start> npm start

> [email protected] start E:\angular\kickstart\blog-start
> tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server"

node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
  Types of property 'lift' are incompatible.
    Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
      Type 'Observable<T>' is not assignable to type 'Observable<R>'.
        Type 'T' is not assignable to type 'R'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\XYZ\AppData\Roaming\npm-cache\_logs\2017-10-26T10_14_42_254Z-debug.log

The Logfile:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\XYZ\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Users\XYZ\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;E:\angular\kickstart\blog-start\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\;C:\MinGW\bin;C:\Program Files\nodejs\;C:\Users\XYZ\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\XYZ\AppData\Local\Programs\Python\Python36-32\;C:\Users\XYZ\AppData\Local\Programs\Python\Launcher\;C:\Users\XYZ\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files (x86)\CMake\bin;C:\Users\XYZ\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: E:\angular\kickstart\blog-start
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c',
10 silly lifecycle   'tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" ' ]
11 silly lifecycle [email protected]~start: Returned: code: 2  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\XYZ\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at EventEmitter.emit (events.js:191:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\XYZ\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:920:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid [email protected]
15 verbose cwd E:\angular\kickstart\blog-start
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\XYZ\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v6.11.5
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
22 error Exit status 2
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Upvotes: 1

Views: 666

Answers (2)

ppenchev
ppenchev

Reputation: 157

It looks like it has something to do with Angular CLI (npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"), which I cannot see in your package.json file

My suggestion to you is to make a new clean project with Angular CLI Create some new folder Install there Angular CLI -> npm install @angular/cli Install angular project -> ng new your-project-name

You can always try to update to latest version your NodeJS or to install only Angular CLI in your current project with the command above

Upvotes: 0

Vueer
Vueer

Reputation: 1502

You have to install a newer version of node.js and npm:

Node JS
NPM: npm install npm@latest -g

Upvotes: 1

Related Questions