'Heros demo wont run
Been a few years since working with Angular so I thought I would just go through a demo again, the tour of heros. https://angular.io/tutorial/toh-pt4
Downloaded the latest Angular CLI and installed typescript:
@angular-devkit/architect 0.1303.4 (cli-only)
@angular-devkit/build-angular <error>
@angular-devkit/core 13.3.4 (cli-only)
@angular-devkit/schematics 13.3.4 (cli-only)
@angular/cli 13.3.4 (cli-only)
@schematics/angular 13.3.4 (cli-only)
rxjs 6.6.7 (cli-only)
typescript 4.6.4 (cli-only)
Using VS Code, opened a terminal and used npm install to refresh my modules, but got this dump of errors. Help?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rxjs
npm ERR! rxjs@"~7.4.0" from the root project
npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"~13.3.0" from the root project
npm ERR! peer @angular/common@">=8.0.0" from [email protected]
npm ERR! node_modules/angular-in-memory-web-api
npm ERR! angular-in-memory-web-api@"~0.11.0" from the root project
npm ERR! 1 more (@angular/core)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^6.0.0" from [email protected]
npm ERR! node_modules/angular-in-memory-web-api
npm ERR! angular-in-memory-web-api@"~0.11.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
package.json
This is directly via downloading from the Angular.io website
https://angular.io/generated/zips/toh-pt4/toh-pt4.zip
{
"name": "angular.io-example",
"version": "0.0.0",
"description": "Example project from an angular.io guide.",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~13.3.0",
"@angular/common": "~13.3.0",
"@angular/compiler": "~13.3.0",
"@angular/core": "~13.3.0",
"@angular/forms": "~13.3.0",
"@angular/platform-browser": "~13.3.0",
"@angular/platform-browser-dynamic": "~13.3.0",
"@angular/router": "~13.3.0",
"angular-in-memory-web-api": "~0.11.0",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.0",
"@angular/cli": "~13.3.0",
"@angular/compiler-cli": "~13.3.0",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"copyfiles": "^2.4.1",
"jasmine-core": "~3.10.0",
"jasmine-marbles": "~0.8.3",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"protractor": "~7.0.0",
"ts-node": "~10.1.0",
"typescript": "~4.5.2"
}
}
Solution 1:[1]
This happened to me as well (using the tutorial code from https://angular.io/generated/zips/universal/universal.zip and https://angular.io/tutorial - https://angular.io/generated/zips/toh-pt6/toh-pt6.zip).
Using npm i --force helps to install the packages, however the warnings stay.
As @MikeOne suggests, using npm i rxjs@6 actually installs the missing version and fixes the problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tony |
