Solvedangular cli Cannot find module '@angular/compiler-cli' when running ng serve

Error: Cannot find module '@angular/compiler-cli'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/plugin.js:5:24)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/index.js:5:10)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/@angular/cli/models/webpack-configs/typescript.js:4:19)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/@angular/cli/models/webpack-configs/index.js:9:10)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/@angular/cli/models/webpack-config.js:4:27)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/@angular/cli/tasks/serve.js:10:26)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Class.run (/usr/local/lib/node_modules/@angular/cli/commands/serve.js:74:27)
at Class. (/usr/local/lib/node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:103:7)

@angular/cli: 1.0.0-beta.31
node - v7.5.0
npm - 4.1.2

Please help when running ng serve, the angular cli not found error comes up.

41 Answers

✔️Accepted Answer

Remove angular-cli from your package.json and replace it with @angular/cli

$ npm uninstall angular-cli
$ npm install @angular/cli --save-dev

That seemed to work for me.

Other Answers:

got it, to upgrade from "angular-cli" to "@angular/cli" run this:

update angular-cli to the latest version

$ npm remove -g angular-cli
$ npm install -g @angular/cli@latest

update the project dependencies

$ rm -rf node_modules dist
$ npm install --save-dev @angular/cli@latest
$ npm install

source:
https://github.com/angular/angular-cli#updating-angular-cli

Having the same issue, after an angular-cli -> @angular/cli upgrade. It's an unmet peerdep with @angular/cli-compiler.

Fixed by doing:

npm uninstall angular-cli -g
npm uninstall angular-cli --save
npm install -g @angular/cli
npm install @angular/cli --save
npm install @angular/compiler-cli --save

However, surely there's a better way.

this happens to me too, just after runing:
$ npm remove -g angulat-cli
$ npm install -g @angular/cli

npm install @angular-devkit/core --save-dev
Worked for

More Issues: