angular-cli: @angular/compiler-cli package was not properly installed; cannot find module @angular/compiler

Repro steps.

ng serve

The log given by the failure.


\The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler'
Error: The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler'
    at Object.<anonymous> (C:\Users\praha\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\index.js:14:11)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\praha\AppData\Roaming\npm\node_modules\@angular\cli\tasks\eject.js:10:19)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)

Desired functionality.

Start server

Mention any other details that might be useful.

  1. tried uninstalling angular package and reinstalling it
  2. running node version 6.11
  3. it says typescript is required, but doesn’t install it
  4. on meeting dependencies separately also, it doesn’t download @angular/compiler

image image

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 41 (2 by maintainers)

Most upvoted comments

Fixed by https://github.com/angular/angular-cli/pull/7033.

We had a bug where ng new didn’t wait for the packages to install. Newer versions don’t suffer from this. Removing node_modules and running npm install should clear it.

first : npm install -g @angular/cli 2 : ng new “your project name” 3 : ng serve : erro >>> do not wrray 4 : npm install @angular/compiler-cli 5 : npm install typescript 6 : npm install @angular/cli

it is work !!

@moezkorkmaz you’re experiencing something different. This issue was about @angular/compiler-cli not being in installed, but yours is about @angular/cli not being in the dependencies. Please open a new issue for yours.

The biggest mistake which people do, is that they are not in the project folder , ng serve in that case fails, because it fails to find angular project. So make sure you are in right folder

To resolve the issue, you need to navigate to the correct folder. eg: cd sampleapplication image

I had a similar issue: when I ran ng-serve I got the same error that informed me that angular cli is not properly installed. My issue was that the project’s devDependencies weren’t installing. I had the global NODE_ENV variable set to production from a different project, which forces npm to ignore devDependencies when installing.
After changing that variable’s value and running npm i, everything is working as expected. Hope this helps anyone else!

EDIT: Resolved the issue by updating the @angular/cli to 1.2.6 and recreating the project from scratch.

Had this same issue. Deleted /node_modules and re-ran npm install with no success. Any other ideas?

compiler-cli error

"dependencies": {
    "@angular/animations": "^4.3.2",
    "@angular/cdk": "^2.0.0-beta.8",
    "@angular/common": "4.3.2",
    "@angular/compiler": "4.3.2",
    "@angular/core": "4.3.2",
    "@angular/forms": "4.3.2",
    "@angular/http": "^4.3.2",
    "@angular/material": "^2.0.0-beta.8",
    "@angular/platform-browser": "4.3.2",
    "@angular/platform-browser-dynamic": "4.3.2",
    "@angular/router": "4.3.2",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.2.1",
    "@angular/compiler-cli": "4.3.2",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }

Node Version: 8.1.2 CLI version: 1.2.1 NPM Version: 5.0.3

I had also similar issue, I have followed the steps First, npm install -g @angular/cli create new project with ng new hero-app After the go inside the project folder and run server ng serve and open browser and run http://localhost:4200

This is work for me… Hope same thing work for you as well

I just changed to “@angular/compiler-cli”: “^4.3.2” from “@angular/compiler-cli”: “^4.0.0” in devDependencies in package.json file.

It worked for me

I experience the same problem.

> ng serve
Unable to find "@angular/cli" in devDependencies.

Please take the following steps to avoid issues:
"npm install --save-dev @angular/cli@latest"

Executing npm install --save-dev @angular/cli@latest did not help.

You just need to reinstall the installation process

  1. npm install -g @angular/cli

(In your ‘root files’ (not in angular files ) )

  1. ng new my-app

Not in angular files — If you have already created this file change the name like ‘my-app1’ or 2 … )

  1. ng serve

(In your ‘Angular files’ )

Its works for me !`

If you’re still facing this issue, do the following (inside the project folder):

  • Delete your node_modules dir
  • Delete your package-lock.json
  • Run npm install
  • Run npm link
  • Done

Hope it helps

I was getting the same error and was able to solve it by reinstalling angular-cli locally. npm i @angular/cli

This is why 3 years ago I migrated mostly to react… (Happened to me today)

I managed to get mine fixed by first running the npm install "whatever-it-says-i-am-missing" and then i ran npm update and i got a new hint from cli to change my environment configurations.

I was also facing the same problem, But after restarting my system it all working fine.

Hi there. I follow asfo steps and that work for me. Now I am going to build great ng app. 😃

Restarting did solve my issue