Last updated: Apr 4, 2024
Reading timeยท2 min
To solve the error "Could not find module '@angular-devkit/build-angular'",
make sure to install the package by opening your terminal in your project's root
directory and running the following command:
npm i -D @angular-devkit/build-angular
and restart your IDE and development
server.
Open your terminal in your project's root directory (where your package.json
file is located) and run the following command:
# ๐๏ธ with NPM npm install --save-dev @angular-devkit/build-angular # ๐๏ธ or with YARN yarn add @angular-devkit/build-angular --dev
@angular-devkit/build-angular
package to the development dependencies of your project.If the error is not resolved, try restarting your IDE and your development server.
If you still get the error, try to update the versions of your NPM packages by running the following command:
npm update
If the error is not resolved, try to delete your node_modules
and
package-lock.json (not
package.json
) files, re-run npm install
and restart your IDE.
# ๐๏ธ (macOS/Linux) delete node_modules and package-lock.json rm -rf node_modules rm -f package-lock.json rm -f yarn.lock # ๐๏ธ (Windows) delete node_modules and package-lock.json rd /s /q "node_modules" del package-lock.json del -f yarn.lock # ๐๏ธ clean your npm cache npm cache clean --force # ๐๏ธ install packages npm install npm install --save-dev @angular-devkit/build-angular
If you get any errors with the installation of the package, try running the
command with the --force
flag.
npm install --save-dev @angular-devkit/build-angular --force
If you still get the error, open your package.json
file and make sure it
contains the @angular-devkit/build-angular
package in the devDependencies
object.
{ // ... rest "devDependencies": { "@angular-devkit/build-angular": "^13.3.0", } }
You can try to manually add the line and re-run npm install
.
npm install
Or install the latest version of the package:
npm install --save-dev @angular-devkit/build-angular@latest # ๐๏ธ with YARN yarn add @angular-devkit/build-angular@latest --dev
The @angular-devkit/build-angular
module should NOT be globally installed or
be in your project's dependencies
, it should be in the devDependencies
object in your package.json
file.
Run the following commands to reinstall the @angular/cli
package if the error
persists.
npm uninstall -g @angular/cli npm cache clean --force npm install -g @angular/cli@latest npm install ng build ng serve
If the error is not resolved, try restarting your IDE and your development server.
You can learn more about the related topics by checking out the following tutorials: