I have an electron app written using Angular 2. I want to include the Router angular module.
My old package.json has these dependencies:
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "~3.1.1",
"angular2-in-memory-web-api": "0.0.10",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"jquery": "3.0.0",
"xml2js": "^0.4.17"
}
This worked fine but of course doesn't have the router. So i added the router using this line :
"@angular/router": "~3.1.1",
Which threw these messages:
├── UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.1
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.1
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.1
├── @angular/http@2.0.0-rc.1
├── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.0-rc.1
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@2.0.0-rc.1
└── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.6
npm WARN @angular/forms@2.1.2 requires a peer of @angular/common@2.1.2 but none was installed.
npm WARN @angular/forms@2.1.2 requires a peer of @angular/core@2.1.2 but none was installed.
npm WARN @angular/router@3.1.2 requires a peer of @angular/common@2.1.2 but none was installed.
npm WARN @angular/router@3.1.2 requires a peer of @angular/core@2.1.2 but none was installed.
npm WARN @angular/router@3.1.2 requires a peer of @angular/platform-browser@2.1.2 but none was installed.
npm WARN @angular/router@3.1.2 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN @angular/upgrade@2.1.2 requires a peer of @angular/compiler@2.1.2 but none was installed.
npm WARN @angular/upgrade@2.1.2 requires a peer of @angular/core@2.1.2 but none was installed.
npm WARN @angular/upgrade@2.1.2 requires a peer of @angular/platform-browser@2.1.2 but none was installed.
npm WARN @angular/upgrade@2.1.2 requires a peer of @angular/platform-browser-dynamic@2.1.2 but none was installed.
So I changed my dev dependencies to the following:
"dependencies": {
"@angular/common": "2.1.2",
"@angular/compiler": "2.1.2",
"@angular/core": "2.1.2",
"@angular/http": "2.1.2",
"@angular/platform-browser": "2.1.2",
"@angular/platform-browser-dynamic": "2.1.2",
"@angular/router": "~3.1.1",
"angular2-in-memory-web-api": "0.0.10",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.12",
"jquery": "3.0.0",
"xml2js": "^0.4.17",
"@angular/router": "~3.1.1"
}
However after doing this I get he following warnings:
sudo npm install
npm WARN lifecycle star@1.0.0~postinstall: cannot run in wd %s %s (wd=%s) star@1.0.0 typings install /Users/asdd/Documents/Personal/Toolkit
star@1.0.0 /Users/asdd/Documents/Personal/Toolkit
├── UNMET PEER DEPENDENCY @angular/core@2.1.2
├── UNMET PEER DEPENDENCY @angular/http@2.1.2
└── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12
npm WARN angular2-in-memory-web-api@0.0.10 requires a peer of @angular/core@2.0.0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api@0.0.10 requires a peer of @angular/http@2.0.0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api@0.0.10 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm ERR! code 1
I am not sure why -- this angular2-in-memory-web-api is not referenced in my package.json -- it used to be but I removed it because I am not sure what it is - and to my knowledge my application doesn't use it, but somehow its still showing up and causing dependency issues! My application also still fails to resolve the import { RouterModule } from '@angular/router'; line.
The entire dependencies list as it stands is as follows:
"devDependencies": {
"angular2-template-loader": "^0.5.0",
"electron-prebuilt": "^1.2.2",
"es6-shim": "^0.34.0",
"raw-loader": "^0.5.1",
"ts-loader": "^0.7.2",
"typescript": "^1.7.3",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"@angular/common": "2.1.2",
"@angular/compiler": "2.1.2",
"@angular/core": "2.1.2",
"@angular/http": "2.1.2",
"@angular/platform-browser": "2.1.2",
"@angular/platform-browser-dynamic": "2.1.2",
"@angular/router": "~3.1.1",
"angular2-in-memory-web-api": "0.0.10",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.12",
"jquery": "3.0.0",
"xml2js": "^0.4.17"
}
This is star project's entire package.json file:
{
"name": "star",
"version": "1.0.0",
"private": true,
"description": "blah blah blah",
"main": "index.js",
"scripts": {
"build": "webpack --progress --profile --colors --display-error-details --display-cached",
"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1",
"package-mac": "electron-packager . macapp --platform=mac --arch=x64",
"package": "electron-packager . --all",
"postinstall": "typings install"
},
"keywords": [
"blah"
],
"author": "coohoo",
"license": "SEE LICENCE IN licence.txt",
"devDependencies": {
"angular2-template-loader": "^0.5.0",
"electron-prebuilt": "^1.2.2",
"es6-shim": "^0.34.0",
"raw-loader": "^0.5.1",
"ts-loader": "^0.7.2",
"typescript": "^1.7.3",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"@angular/common": "2.1.2",
"@angular/compiler": "2.1.2",
"@angular/core": "2.1.2",
"@angular/http": "2.1.2",
"@angular/platform-browser": "2.1.2",
"@angular/platform-browser-dynamic": "2.1.2",
"@angular/router": "2.0.0-rc.2",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.12",
"jquery": "3.0.0",
"xml2js": "^0.4.17"
}
}
After removing the in memory api, I get the following error:
npm WARN angular2-in-memory-web-api@0.0.10 requires a peer of @angular/core@2.0.0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api@0.0.10 requires a peer of @angular/http@2.0.0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api@0.0.10 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
The package.json is now as shown above.
Many thanks for any and all advice.
starpackage although I'm not sure where that's coming from (especially since it points to your local Documents folder). Have you looked at it to make sure it's dependencies are valid/up to date? – Dave V Nov 2 '16 at 19:27rc.2you'll need to update that to the latest version too – Dave V Nov 2 '16 at 19:41