Solvedangular cli The "@angular/compiler-cli" package was not properly installed.

[X ] bug report -> please search issues before submitting

**Versions.**
@angular/cli: 1.0.0
node: 7.1.0
os: win32 x64
@angular/common: 2.1.2
@angular/compiler: 2.1.2
@angular/core: 2.1.2
@angular/forms: 2.1.2
@angular/http: 2.1.2
@angular/platform-browser: 2.1.2
@angular/platform-browser-dynamic: 2.1.2
@angular/router: 3.1.2
@angular/cli: 1.0.0


**Repro steps.**

run ng serve



**The log given by the failure.**

$ ng serve --verbose
The "@angular/compiler-cli" package was not properly installed.
Error: The "@angular/compiler-cli" package was not properly installed.
    at Object.<anonymous> (C:\Users\rball\Documents\Dev\Angular\change-detection\node_modules\@ngtools\webpack\src\index.js:16:11)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\rball\Documents\Dev\Angular\change-detection\node_modules\@angular\cli\tasks\eject.js:10:19)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)


**### Desired functionality.**
Launch ng serve without error


**### Mention any other details that might be useful.**
Have updated project and environment per "https://github.com/angular/angular-cli#updating-angular-cli"

See also http://stackoverflow.com/questions/42925690/angular2-cli-error-angular-compiler-cli-package-was-not-properly-installed/43021209#43021209

Package.json

{
  "name": "change-detection",
  "version": "0.0.0",
  "license": "MIT",
  "@angular/cli": {"version": "1.0.0"},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~2.1.0",
    "@angular/compiler": "~2.1.0",
    "@angular/core": "~2.1.0",
    "@angular/forms": "~2.1.0",
    "@angular/http": "~2.1.0",
    "@angular/platform-browser": "~2.1.0",
    "@angular/platform-browser-dynamic": "~2.1.0",
    "@angular/router": "~3.1.0",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0",
    "@types/jasmine": "^2.2.30",
    "@types/node": "^6.0.42",
    "codelyzer": "1.0.0-beta.1",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3",
    "webdriver-manager": "10.2.5"
  }
}
55 Answers

✔️Accepted Answer

FUCK!!!

Other Answers:

@codestation if you're building on Heroku, you need to move compiler-cli amongst a few other packages to "dependencies" as Heroku only installs packages in production mode.

Here's an example package.json that works on Heroku with a basic server. I keep seeing this daily, I guess it's time for me to write my first blog post :)

{
  "name": "wildcase",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "serve": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "start": "node server",
    "postinstall": "ng build --target=production -e ${NODE_ENV:-production} --aot"
  },
  "private": true,
  "dependencies": {
    "@angular/cli": "1.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "bootstrap": "4.0.0-alpha.6",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "rxjs": "^5.1.0",
    "typescript": "~2.2.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0"
  }
}

Notice how I moved @angular/cli @angular/compiler-cli and a few others to dependencies

Seems to be related to #5131. Resolved in the same way (upgrade typescript to latest).

@intellix solved the problem for me. I added the line

...
"@angular/compiler-cli":"^2.3.1",
...

version was the same as my other dependencies.

add @angular/compiler-cli to package.json and install it (same version as your other @angular libs. It's required as per the error message :)

Easiest way to debug any CLI error is to just generate a new project and compare files like your package.json: ng new temporary

More Issues: