ng serve cannot find the dev-server builder package
Could not find the implementation for builder @angular-devkit/build-angular:dev-serverShort answer
The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root. If that package is not in node_modules, the CLI cannot load it. Install the dependencies, or install the builder package that angular.json names.
Fix it fast
1Find out which cause you have
Read the builder name from angular.json, then ask npm whether that package is installed next to it.
grep -n '"builder"' angular.json npm ls @angular/build @angular-devkit/build-angular2Match what you see, then jump to its fix
- 1
npm ls prints (empty) or the folder node_modules does not existnode_modules is missing or was never installedFix - 2
node_modules exists, but npm ls does not list the package named in the builder lineThe builder package named in angular.json is not a dependencyFix - 3
npm ls works in a parent or child folder but fails in the folder that holds angular.jsonnode_modules is in a different folder than angular.jsonFix
- 1
What does the error look like?
Could not find the implementation for builder @angular-devkit/build-angular:dev-serverCould not find the implementation for builder @angular/build:dev-server
Cause 1 of 3
node_modules is missing or was never installed
1Check
A fresh clone has no node_modules. The CLI resolves the builder package from the workspace root, so with no install there is nothing to find.
ls node_modules | head2Fix
Install from package.json. Use npm ci when package-lock.json is committed and must not change.
npm install
# or, to follow the lockfile exactly
npm ci3Verify
The package now shows in npm ls and the server starts.
npm ls @angular/build
ng serveConfirmed by docs.npmjs.com
Cause 2 of 3
The builder package named in angular.json is not a dependency
1Check
A project created with a current CLI uses @angular/build; an older one uses @angular-devkit/build-angular. If you removed one package, or copied angular.json from another project, the names no longer match what package.json installs.
grep -n '"builder"' angular.json
grep -n 'build-angular\|@angular/build' package.json2Fix
Install the package that angular.json names, as a dev dependency. To move an older project to the current builders, run the CLI's migration instead.
npm install --save-dev @angular/build
# to migrate from @angular-devkit/build-angular
ng update @angular/cli --name use-application-builder3Verify
Run the dev server again and check that the build starts.
ng serveConfirmed by raw.githubusercontent.com
Cause 3 of 3
node_modules is in a different folder than angular.json
1Check
The CLI starts searching at the workspace root, the folder with angular.json, and follows Node's normal module lookup upwards. Dependencies installed in a sibling or child folder are never seen.
ls angular.json package.json
npm ls @angular/build2Fix
Run the install in the folder that holds both package.json and angular.json, and run ng from there.
cd path/to/workspace && npm install3Verify
The listing shows the package, and ng serve starts.
npm ls @angular/build && ng serveConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Commit package-lock.json and install with npm ci in CI and on new machines.
- Change builders in angular.json and the dependency in package.json in the same commit.
- Keep package.json and angular.json in the same folder.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fixBack end
The command npm run build -- --prod exited with code 1 (Angular)
The command "npm run build -- --prod" exited with code 1
Exit code 1 only says the build failed; the real message is above it.
2 causes, each with a fixBack end
Angular build fails with SassError: Undefined variable
SassError: Undefined variable.
Sass modules loaded with @use are scoped to the file that loads them and their variables need a namespace prefix.
4 causes, each with a fix