Reputation: 115
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.
Upvotes: 1
Views: 6755
Reputation: 28259
Check your package.json
if it contains all the right packages. Make sure that you're running the latest typescript.
Try to reinstall your npm modules:
npm install rimraf -g
rimraf node_modules
npm install
Upvotes: 0
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
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
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.
Upvotes: 2
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
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