The situation of updating a version to a newer version and an error occurs is quite familiar to programmers. This can happen in most browsers or applications. In this article, we will talk about Angular and specifically the “Could not find module ‘@angular-devkit/build-angular’” error. We will provide help to to find the finest reply for this error . Let’s scroll down and get began on encountering the key proper now!
What causes error?
In Angular 6.0, the developer launched the
@angular-devkit/build-angular package deal that features like a dependency. Therefore, in different extra superior variations of Angular, it would not be appropriate. If you’re utilizing a model larger than Angular 6, it would present the error message
Could not find module '@angular-devkit/build-angular'
How to fix the error “Could not find module ‘@angular-devkit/build-angular’”?
The most common and recommended approach is to update to the new version. However, in this article we will introduce you to some other ways to handle it. Follow each method and choose the one that is convenient and right for you.
Solution 1: Remove and install new version
This is the easiest method to implement and the most widely used. First, you need to access the node_modules folder and manually delete the old versions that are pre-installed on the machine. Next run the command
npm cache clean --verify to clear the cache. And finally, run the command
npm install to fully install the Angular packages of the latest version.
Method 2: Install new dependency package “@angular-devkit/build-angular”
In the Angular 6 version, the developer released a dependency package that is compatible with it, which is @angular-devkit/build-angular. Thus, the way to handle the above error was much simpler. By running one of the two commands below to install the package, the error should be fixed.
npm install --save-dev @angular-devkit/build-angular
yarn add @angular-devkit/build-angular --dev
Method 3: Reinstall @angular/cli
If you have @angular/cli installed on your machine, you can also consider reinstalling it if the above two methods don’t work.
Similarly, first you want to take away the outdated model with the command “
npm uninstall -g @angular/cli“. Then run the command
npm cache clean --force to clear the cache. Now you can run
npm install -g @angular/[email protected] and
npm install to install the latest version for it. Finally run
ng build or
ng serve to launch the app.
Method 4: Update version
If the above methods do not work, you can update the version again so that the error does not appear. Use the following command:
Above is the best key to solve the error “Could not find module ‘@angular-devkit/build-angular’”. If you have got any additional questions, you possibly can go away your feedback in the Comments part. UnliHow hopes you have got a productive day along with your topic. See you in the subsequent session!