Background: I am working on an Angular project that combines Angular 7 and some newer Angular 19 packages. The goal is to successfully run the project using ng serve.
The Issue: I am encountering the following problems:
When running
ng serve, I get the error:
"Could not find module '@angular-devkit/build-angular' from '...'."After updating Node.js and Angular CLI, I get the error:
"TS18003: No inputs were found in config file 'tsconfig.json'."
What I Have Tried:
Updated Node.js to version 18.20.5 to ensure compatibility with Angular CLI and other dependencies.
Adjusted the
angular.jsonandtsconfig.jsonfiles based on various recommendations found online. For example:Ensured that the
compilerOptionsintsconfig.jsonincluded proper paths and inputs.Made sure that the
angular.jsonfile referenced valid builder packages.
Cleared and reinstalled
node_modulesusing:rm -rf node_modules npm installRan
npm audit fixto resolve any potential dependency issues.Searched online for similar issues and applied suggested fixes, but none worked.
Key Configuration Details: Here are the relevant sections of my package.json:
"dependencies": {
"@angular/animations": "^7.2.16",
"@angular/common": "^7.2.16",
"@angular/compiler": "^19.0.0",
"@angular/core": "^7.2.16",
"@angular/forms": "^7.2.16",
"@angular/platform-browser": "^7.2.16",
"@angular/platform-browser-dynamic": "^19.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~15.0.0",
"@angular/cli": "^19.0.0",
"@angular/compiler-cli": "^19.0.0",
"typescript": "~4.8.4"
}
My angular.json file includes the following section:
"projects": {
"app": {
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser"
}
}
}
}
What I Expected: I expected the project to start successfully with ng serve without dependency or configuration errors.
Related Questions: I reviewed similar questions like:
However, none of them resolved my issue. My project uses a mix of Angular 7 and Angular 19 packages, which may be causing additional compatibility issues that were not covered in those answers.
My Question: What additional steps can I take to resolve these dependency and configuration issues? Should I downgrade all dependencies to align with Angular 7, or is there a better approach to mix versions?
Repository Link: For a full view of the configuration, see my repository: GitHub Repository.
ng updateis pretty painless and getting on to a newer version opens the door to performance, security, DX, and troubleshooting improvements.ng update. Any tips for handling a major version upgrade like this?ng update. Any tips or precautions for handling major version upgrades?