Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Angular2 to latest version

I am trying to update Angular2 to the latest version release candidate 4.

I have executed npm outdated and edited accordingly the package.json file. Then I have executed npm update which failed. I haven't saved the error message. In the following I googled and tried several different npm commands. Unfortunately I cannot recall them.

The current status is, that npm update does not show anything; so seems to work. The command npm start starts the server, but the browser console displays multiple errors. The first is:

http://localhost:3000/node_modules/@angular/platform-browser-dynamic/platform-browser-dynamic.umd.js Failed to load resource: the server responded with a status of 404 (Not Found)

Besides npm install shows the following warnings:

typings WARN deprecated 2016-06-02: "registry:dt/core-js#0.0.0+20160317120654" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/node#4.0.0+20160509154515" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/jasmine#2.2.0+20160505161446" is deprecated (updated, replaced or removed)

├── core-js (global)
├── jasmine (global)
└── node (global)

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /lite-server/browser-sync/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN @angular/[email protected] requires a peer of [email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of [email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of [email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of [email protected] but none was installed.

The package.json relevant parts are currently:

"dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.2",
    "@angular/upgrade": "2.0.0-rc.4",
    "angular2-in-memory-web-api": "0.0.14",
    "angular2-uuid": "^1.0.7",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.9",
    "systemjs": "0.19.31",
    "zone.js": "^0.6.12"
  },
"devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings": "^1.0.4",
    "canonical-path": "0.0.2",
    "http-server": "^0.9.0",
    "tslint": "^3.7.4",
    "lodash": "^4.11.1",
    "jasmine-core": "~2.4.1",
    "karma": "^1.1.0",
    "karma-chrome-launcher": "^1.0.1",
    "karma-cli": "^1.0.1",
    "karma-htmlfile-reporter": "^0.3.4",
    "karma-jasmine": "^1.0.2",
    "protractor": "^3.3.0",
    "rimraf": "^2.5.2"
  },
like image 587
Johannes Avatar asked May 29 '26 02:05

Johannes


2 Answers

Follow these steps:

  1. Delete node_modules folder.

  2. Take latest package.json from https://angular.io/guide/quickstart

  3. Run 'npm install' command.

like image 105
Sanket Avatar answered May 31 '26 16:05

Sanket


In typings.json one must update to new registry value, if problem shows up for core-js

"core-js": "registry:dt/core-js#0.0.0+20160317120654"

to

"core-js": "registry:dt/core-js#0.0.0+20160725163759"

https://github.com/mgechev/angular2-seed/commit/8a8c64e0e8b18cd0c19c1ab2f1dc71a30bbd6174

like image 33
nirvana74v Avatar answered May 31 '26 16:05

nirvana74v



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!