2

enter image description here

This is my first attempt on learning Angular JS and trying to run an application from here.

Below is the package.json

{
  "name": "apm",
  "version": "0.0.0",
  "license": "MIT",
    "scripts": {
      "ng": "ng",
      "start": "ng serve -o",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint --type-check",
      "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
      "@angular/animations": "^4.0.0",
      "@angular/common": "^4.0.0",
      "@angular/compiler": "^4.0.0",
      "@angular/core": "^4.0.0",
      "@angular/forms": "^4.0.0",
      "@angular/http": "^4.0.0",
      "@angular/platform-browser": "^4.0.0",
      "@angular/platform-browser-dynamic": "^4.0.0",
      "@angular/router": "^4.0.0",
      "bootstrap": "^3.3.7",
      "core-js": "^2.4.1",
      "rxjs": "^5.4.1",
      "zone.js": "^0.8.14"
    },
    "devDependencies": {
      "@angular/cli": "1.6.3",
      "@angular/compiler-cli": "^4.0.0",
      "@angular/language-service": "^4.0.0",
      "@types/jasmine": "~2.5.53",
      "@types/jasminewd2": "~2.0.2",
      "@types/node": "~6.0.60",
      "codelyzer": "~3.0.1",
      "jasmine-core": "~2.6.2",
      "jasmine-spec-reporter": "~4.1.0",
      "karma": "~1.7.0",
      "karma-chrome-launcher": "~2.1.1",
      "karma-cli": "~1.0.1",
      "karma-coverage-istanbul-reporter": "^1.2.1",
      "karma-jasmine": "~1.1.0",
      "karma-jasmine-html-reporter": "^0.2.2",
      "protractor": "~5.1.2",
      "ts-node": "~3.0.4",
      "tslint": "~5.3.2",
      "typescript": "~2.3.3"
    }
  }

I've executed the command npm install to make sure all dependancies have been up to date but when I try npm start the above screenshot is what I'm hitting.

I've just installed Angular CLI and verified using ng --version which showing me 1.6.3 so I assume CLI been installed correctly. What could've be the problem?

4
  • 3
    Why do you start learning with a version of angular that is already several months old (4.0.0)? Read the official getting started: angular.io/guide/quickstart Commented Jan 6, 2018 at 8:10
  • I'm actually following the course that subscribed from Pluralsight..thinking to start from somewhere, anywhere. Anyway, thanks for the heads up, will definitely take a look at your link Commented Jan 6, 2018 at 8:12
  • @IsaacLem "@angular/cli": "1.6.3", supports angular 5 only ... you need to create a new project using ng new which creates the package.json with angular 5 dependency and does the npm install. for you or you can skip the automatic install Commented Jan 6, 2018 at 8:17
  • Originally it was "@angular/cli": "1.2.4" at package.json and I thought that my CLI version is 1.6.3 and hence I've updated the value myself. I tried to revert back to 1.2.4 and re-run npm install and npm start its still hitting same issue Commented Jan 6, 2018 at 8:27

2 Answers 2

2

I have cloned the project and it works fine. You have to use ng server instead of npm start.

You could also update the local cli with this commands

npm uninstall @angular/cli
npm install @angular/cli@latest

UPDATE

I found an issue on angulars github repository with the same error message as yours.

The error is reproducible by deleting the configuration file for the angular cli called .angular-cli.json. I deleted it and got the same error message as you.

Check that this file is not missing in your project. If it's not there then restore it from git.

Sign up to request clarification or add additional context in comments.

5 Comments

I was managed to execute the first command only. Second command throwing me Invalid package name "@angular/cli/": name can only contain URL-friendly characters
sorry there was a typo in that command, remove the / before @latest
both command been executed successfully and cli is again version 1.6.3 however trying ng server still hitting same issue
@IsaacLem He meant ng serve.
@zgue: Big thumbs up! Thanks for the update. It is indeed the root cause.
1

Just upgrade Angular CLI and run ng new on new folder. There is only small changes between Angular 4 and Angular 5.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.