Angular 6 - Could not find module "@angular-devkit/build-angular"
Angular 6 - Could not find module "@angular-devkit/build-angular" Error: Easy Fix! 💪🔧
So you've updated your Angular version to 6.0.1 and now you're getting the dreaded error message:
Could not find module "@angular-devkit/build-angular" from "/home/Projects/myProjectName".
Error: Could not find module "@angular-devkit/build-angular" from "/home/Projects/myProjectName".
You're probably scratching your head wondering what went wrong, especially since running ng update
reassured you that everything was in order. But don't worry, we've got you covered with an easy solution to fix this issue! 💡
Problem Overview:
This error occurs when the module @angular-devkit/build-angular
cannot be found in your project.
Possible Solution:
Solution 1: The first thing you should try is deleting the
node_modules
folder and performing a freshnpm install
. Sometimes, the dependencies can get messed up during the update process, and a clean installation can effectively resolve the problem.Solution 2: If Solution 1 doesn't work, it could be because the
@angular-devkit/build-angular
package is not included as a dependency in your project'spackage.json
file. To fix this, you need to manually add it.Open your project's
package.json
file.Scroll down to the
dependencies
section.Add
"@angular-devkit/build-angular": "^0.6.8"
to the list of dependencies.Save the file.
Run
npm install
to install the missing module.
Note: Make sure to use the appropriate version number for your project.
Example Fixes:
Here are some examples of how this error can be fixed based on the provided context:
Example 1:
If your project's package.json
already contains the @angular-devkit/build-angular
dependency, but you're still facing the error, try Solution 1 and Solution 2.
Example 2:
If your project is based on ng2-admin (Angular4 version) and you're getting the error, here's what you can do:
Open your project's
package.json
file.Add
"@angular-devkit/build-angular": "^0.6.8"
to the list of dependencies.Run
npm install
to install the missing module.
Call-To-Action:
Voila! 🎉 You've successfully resolved the Could not find module "@angular-devkit/build-angular"
error. Now you can confidently run ng serve
and continue working on your Angular 6 project without any issues.
If you found this blog post helpful, make sure to share it with your fellow Angular developers who might be facing the same problem. And don't forget to leave a comment if you have any further questions or suggestions to improve our guide.
Happy coding! 😎💻