I have a an Angular project (which has multiple projects inside) which I updated to Angular v18.2.12. I managed to update all dependencies but TS doesn't let me build, since 4.0.8 is installed but needs either 5.4.0 ro 5.6.0. When I try to run npm i typescript@5.4.0
the terminal gets stuck in the process of the install, specifically with this segment of code:
npm WARN Could not resolve dependency:
npm WARN peer typescript@">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev" from tslint@5.7.0
npm WARN node_modules/tslint
npm WARN dev tslint@"~5.7.0" from the root project
[#########.........] - idealTree:trunk: timing idealTree:#root Completed in 421ms
Am I doing something wrong?
To perform the install without the dependency errors, you can use --legacy-peer-deps
argument.
npm i typescript@~5.4.0 --legacy-peer-deps
After installing the correct typescript you have to upgrade tslint
to ^6.1.3
.
npm i tslint@^6.1.3 --legacy-peer-deps
The legacy peer deps is just to update the package.json
with the proper versions, after you do this, there is no need for the --legacy-peer-deps
params, npm install
should work as it is.
{
"name": "angular-starter",
"private": true,
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build"
},
"dependencies": {
"@angular/animations": "^18.2.12",
"@angular/common": "^18.2.12",
"@angular/compiler": "^18.2.12",
"@angular/core": "^18.2.12",
"@angular/forms": "^18.2.12",
"@angular/platform-browser": "^18.2.12",
"@angular/router": "^18.2.12",
"rxjs": "^7.8.1",
"tslib": "^2.5.0",
"zone.js": "~0.14.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.12",
"@angular/cli": "^18.2.12",
"@angular/compiler-cli": "^18.2.12",
"tslint": "^6.1.3",
"typescript": "~5.5.0"
}
}