1

I am trying to get angular 2 project up and running using the angular-cli. I think angular 4 is installed instead of angular 2 after seeing my Package.json. Could some body tell me the right way of doing it.

I had used the following command to install angular

npm install -g @angular/cli
ng new projectname

Package.json

{
  "name": "mrdb.web",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy.conf.json",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@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",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.6",
    "@angular/compiler-cli": "^4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }
}
Tom
  • 8,175
  • 41
  • 136
  • 267
  • Possible duplicate of [Installing a specific version of angular with angular cli](https://stackoverflow.com/questions/43344600/installing-a-specific-version-of-angular-with-angular-cli) – Tyler Jennings May 30 '17 at 17:31
  • 1
    You can check the package.json of https://stackoverflow.com/documentation/angular2/789/getting-started-with-angular-2/26878/getting-started-with-angular-2-with-node-js-expressjs-backend-http-example-incl#t=201705301731505556728 but i suggest you to go with angular4 – eko May 30 '17 at 17:33
  • Angular/CLI defaults to Angular 4 since the 1.0 release (see the [changelog](https://github.com/angular/angular-cli/blob/master/CHANGELOG.md#100-2017-03-24)) – crashmstr May 30 '17 at 18:02

1 Answers1

1

Edit your package.json to:

"dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",

Then remove node_modules folder rm -rf node_modules and run npm i again

Lucas
  • 9,871
  • 5
  • 42
  • 52