Rajesh Choudhary
Rajesh Choudhary

Reputation: 115

Angular 2 project to Angular 4 update issue

I have recently upgraded my Angular 2 project to Angular 4 ,after going through this official link (Update to Angular 4).

After upgrading,as i am running my Angular app following error is coming and saying my package.json file is having some issues.

Updation errors

Upvotes: 1

Views: 6755

Answers (6)

angularconsulting.au
angularconsulting.au

Reputation: 28259

  1. Check your package.json if it contains all the right packages. Make sure that you're running the latest typescript.

  2. Try to reinstall your npm modules:

    npm install rimraf -g
    rimraf node_modules 
    npm install
    

Upvotes: 0

Ketan Chaudhari
Ketan Chaudhari

Reputation: 556

"devDependencies": {
  "concurrently": "^2.2.0",
  "lite-server": "^2.2.2",
  "typescript": "2.3.4",
  "typings": "^1.3.2"
}

Change typescript version "typescript": "^2.4.0" to "typescript": "^2.3.4" and then command npm install version will be change, and also rxjs version will be "rxjs": "^5.4.2" in package.json. Then run command ng serve it's working. Then you can check your angular version in element.

Upvotes: 1

abhaygarg12493
abhaygarg12493

Reputation: 1605

Steps to update application from angular 2 to angular 4.

1) Delete your node modules

2) Update your dependency In Linux Enviroment

npm install @angular/{
    animations,
    common,
    compiler,
    compiler-cli,
    core,
    forms,
    http,
    platform-browser,
    platform-browser-dynamic,
    platform-server,
    router
}@4.0.0 typescript@latest --save

now serve your app using ng serve or npm start

If you are using Animations, import BrowserAnimationsModule in your root NgModule using

import { BrowserAnimationsModule } from @angular/platform-browser/animations



If you still facing problem then you read from angular Release Note or you can refer this link

Upvotes: 2

Krishna Gupta
Krishna Gupta

Reputation: 179

You can Update by this command if you are using Ubuntu.

npm install @angular/common@next @angular/compiler@next @angular/compiler-cli@next @angular/core@next @angular/forms@next @angular/http@next @angular/platform-browser@next @angular/platform-browser-dynamic@next @angular/platform-server@next @angular/router@next @angular/animations@next --save

Hope this will help you.

Reference website

Upvotes: 2

suriish
suriish

Reputation: 1

Change the Package.json and tsconfig.json contents. For content refer here delete all the files inside node module. run the command "npm install && npm update && npm start".

Upvotes: 0

Bijoy Alfred
Bijoy Alfred

Reputation: 43

While installing the latest node version, first uninstall the older version of node, and manually remove all the node related files from its installation path and try install newer version of node js. Then run "npm clear cache" command as well.

The angular-cli global npm package names are different for angular2 and angular4.

Upvotes: 0

Related Questions