Paul Paul - 2 years ago 178
JSON Question

package.json does not restore correct version of angular in vs 2015 NET Core 1.0.0preview2-003121

I am new to both angular and vs2015. I am totally screwed up when I was trying to add datepicker in my project. Basically I am unable to line up the matched version of angular. I tried many different solutions from internet in the last 8 days but still running around the circle. I have the following package.json and typings.json that are close to the previously working versions in my project. *I might screwed up these copies too. I tried to update the package.json @angular from 2.0.0-rc.2, rc.4, to rc.5. but I am getting different error messages - 'cannot find name'; property ... does not exist etc. I tried to // / and some other update but still not working.

I used the 'npm install' in Package Manager Console in vs2105. In last 2 hours attempts, I noticted that the npm restored with older version rc.2 rather than rc.4 specified in package.json. I used npm clear cache, npm clean, removed the node_modules folder but still couldn't make the restore right. Could anyone give me some hint how to resolve the issue? In addition, is there anyway I can check the compatibility of different modules with different version? Thanks in advance.

vs2015 Solution Explorer - Dependencies - npm

"version": "1.0.0",
"name": "",
"private": true,
"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.2",
"@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/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.2",
"angular2-in-memory-web-api": "0.0.12",
"body-parser": "1.14.1",
"bootstrap": "3.3.6",
"es6-shim": "^0.35.0",
"fancybox": "3.0.0",
"jquery": "2.1.4",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.0.0-beta.10",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
"devDependencies": {
"del": "2.1.0",
"gulp": "3.9.1",
"gulp-typescript": "^2.13.4",
"gulp-watch": "4.3.5",
"merge": "1.2.0",
"typescript": "1.8.10",
"typings": "^0.8.1"
"scripts": {
"postinstall": "typings install"

"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#4.0.0+20160509154515"
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": false,
"noEmitOnError": true,
"moduleResolution": "node",
"removeComments": false,
"sourceMap": true,
"target": "es5",
"module": "commonjs",
"suppressImplicitAnyIndexErrors": true
"exclude": [

Answer Source

The reason you are getting the higher versions of Angular is that you have the ^ character in front of the package versions. That tells NPM to install any suitable upgrade of the package, resulting in you getting the release version of Angular (2.0.0). If you do not want to do that, remove that character from each angular package then re-install, that will force NPM to install the version you specified.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download