0

It seems NG2 is changing so rapidly that I am not longer able to build a project. Been struggling with this for hours and appear to be going round in endless loops trying to get a build out of my project.

$ ng -v
@angular/cli: 1.0.0-rc.0
node: 7.4.0
os: darwin x64
@angular/common: 2.2.0
@angular/compiler: 2.2.0
@angular/core: 2.4.8
@angular/forms: 2.2.0
@angular/http: 2.2.0
@angular/platform-browser: 2.2.0
@angular/platform-browser-dynamic: 2.2.0
@angular/router: 3.2.0
@angular/cli: error
@angular/compiler-cli: error

When I run: ng build I get the following error:

This version of CLI is only compatible with angular version 2.3.1 or better. Please
upgrade your angular version, e.g. by running:
npm install @angular/core@latest

So I run the suggested command and get the following errors:

> fsevents@1.1.1 install /path-to/node_modules/fsevents
> node install

[fsevents] Success: "/path-to/node_modules/fsevents/lib/binding/Release/node-v51-darwin-x64/fse.node" is installed via remote
app@0.1.0 /path-to/app-name
├── UNMET PEER DEPENDENCY @angular/core@2.4.8
├── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12 invalid
└── UNMET PEER DEPENDENCY zone.js@0.6.26 invalid

npm WARN @angular/common@2.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN @angular/compiler@2.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN @angular/core@2.4.8 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @angular/core@2.4.8 requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN @angular/forms@2.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN @angular/http@2.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN @angular/platform-browser@2.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN @angular/platform-browser-dynamic@2.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN @angular/router@3.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN @angular/upgrade@2.2.0 requires a peer of @angular/core@2.2.0 but none was installed.
npm WARN app-name@0.1.0 No description
npm WARN app-name@0.1.0 No repository field.
npm WARN app-name@0.1.0 No license field.

So it appears I need to install the unmet peer dependencies, so:

$npm install @angular/core rxjs zone.js
my-app@0.1.0 /path-to/app
├── @angular/core@2.2.0  invalid
├── rxjs@5.0.0-beta.12  invalid
└── zone.js@0.6.26  invalid

And so around I go...

This is my package.json file...

{
  "name": "my-app",
  "version": "0.1.0",
  "description": "",
  "private":true,
  "scripts": {
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
    "lite": "lite-server",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "dependencies": {
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/router": "^3.4.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.0.0",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.7"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-beta.31",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.0"
  }
}

Any guidance would be appreciated...

HappyCoder
  • 5,985
  • 6
  • 42
  • 73
  • Avoid versions with ^ in front of them if possible. You will get unexpected results. Pro tip if it's your first time, use a starter google for a github page of Angular2 starter. – Mathijs Segers Feb 28 '17 at 12:57
  • Thanks will try removing those ^. This app was built about 4 months ago and it used a basic ng2 starter pack! – HappyCoder Feb 28 '17 at 12:59
  • The chances are very likely those are pulling breaking changes – Mathijs Segers Feb 28 '17 at 13:05
  • If you haven't updated your project in 4 months there are slightly more to do that that. I think the faster would be to create a new project `ng new` and report your project inside. It shouldn't be too long ;) – maxime1992 Feb 28 '17 at 13:29
  • If you are using Angular cli follow the upgrade guide of the rc version. https://github.com/angular/angular-cli/wiki/stories-rc.0-update – Evans M. Feb 28 '17 at 14:18

0 Answers0