angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open rfball opened this issue 9 years ago • 56 comments

[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"
  }
}

rfball avatar Mar 25 '17 20:03 rfball

This is why I hate npm and all this stuff (yes I know it can be great) I am following angular mobile toolkit - I only follow the first 2 steps of the tutorial and splat, nothing works,

If Typescript is a dependency and requires a certain version then npm should ruddy well update it instead of us having to google here and there to resolve it - unstructured nonsense.

paulbackhouse avatar Apr 06 '17 09:04 paulbackhouse

This error happens from the following chunk of code:

https://github.com/angular/angular-cli/blob/master/packages/%40ngtools/webpack/src/index.ts#L8

This code is not ideal. It assumes that if anything went wrong, it is because the user didn't install the right thing. Preferably it would look at the actual error more and try to give a more helpful error message. A stack overflow answer:

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

Suggest that the actual underlying problem is that some version of the package might not expose a VERSION symbol; but I have not investigated whether this is actually true.

Still, more defensive and specific error handling would help when things like this happen.

kylecordes avatar Apr 09 '17 03:04 kylecordes

Setting up an Angular working app is still so tedious. I think this should be addressed by core team. If the team is creating an awesome product, then it should be awesome to use it too. Fixing Angular setup problems are like finding a pearl in shell. Although it gives some deeper understanding when we go under the hood, but how much man/hours we are going to spend in setting up an app. And on top of that we never know what will be changed in next release and the app will start giving such irrelevant messages which does not help a developer at all, that let us wandering. Angular QuickStart was a pain at first and now CLI too.. BTW, I have created brand new app just few moments ago after latest install of @angular/cli and it dont works.

I've applied some changes as recommended above this is how my package.json looks: I have moved "@angular/cli": "1.0.0", "@angular/compiler-cli": "^4.0.0" from devDependencies to Dependencies { "name": "shopper", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/common": "^4.0.0", "@angular/compiler": "^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", "core-js": "^2.4.1", "rxjs": "^5.1.0", "zone.js": "^0.8.4", "@angular/cli": "1.0.0", "@angular/compiler-cli": "^4.0.0" }, "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-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "karma-coverage-istanbul-reporter": "^0.2.0", "protractor": "~5.1.0", "ts-node": "~2.0.0", "tslint": "~4.5.0", "typescript": "~2.2.0" } }

Please do something to give us time to be more creative in creating an Angular App, rather than getting frustrated setting up a working app.

With above said, I love Angular.. Suggest me some solution for my problem. Cheers !

mutanttech avatar Apr 10 '17 11:04 mutanttech

@mutanttech I don't believe you ever really said what problem you're having. You're getting the @angular/compiler-cli package was not properly installed error?

A fresh install out of the box using CLI 1.0.0 should work. Do you have anymore details about your environment? OS/Node version etc

intellix avatar Apr 10 '17 12:04 intellix

@intellix I guess you missed out that I have mentioned in my comment "BTW, I have created brand new app just few moments ago after latest install of @angular/cli and it dont works.". And yes, I am getting the same @angular/compiler-cli package was not properly installed error?

I am using Windows 8.1 Enterprise, Node Version 6.9.5, NPM version. 3.10.1. Let me know if you require any other details. I tried to make it work today by getting latest typescript v 2.2.2. But still the same error.

mutanttech avatar Apr 11 '17 06:04 mutanttech

Cloud 9 Ubuntu 14.04 Node 7.8.0 NPM 4.2.0

Trying to get through the Thinkster.io training and first had a lot of Peer Dependency errors. Now,

freeredpill:~/workspace/angular2-realworld-example-app (master) $ npm uninstall --save-dev angular-cli && npm install --save-dev @angular/cli@latest [email protected] /home/ubuntu/workspace/angular2-realworld-example-app └── @angular/[email protected]

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) freeredpill:~/workspace/angular2-realworld-example-app (master) $ ng serve --host 0.0.0.0 --port 8080 --live-reload-port 8081 The option '--live-reload-port' is not registered with the serve command. Run ng serve --help for a list of supported options. The "@angular/compiler-cli" package was not properly installed. Error: The "@angular/compiler-cli" package was not properly installed. at Object. (/home/ubuntu/workspace/angular2-realworld-example-app/node_modules/@ngtools/webpack/src/index.js:14:11) 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. (/home/ubuntu/workspace/angular2-realworld-example-app/node_modules/@angular/cli/tasks/eject.js:10: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)

biblelogosthegame avatar Apr 11 '17 08:04 biblelogosthegame

The option '--mobile' is not registered with the new command.

manishprashar avatar Apr 24 '17 18:04 manishprashar

I had the same error. The issue was that I forgot that the project was ejected so I had to use npm run server instead of ng serve (you can not launch using ng serve if you've ejected the project). So, just double check if you're ejected or not. If you're working on multiple projects like I was, where some are ejected and some are not, it's easy to forget which ones are which and use ng serve like a reflex

fvoska avatar May 11 '17 07:05 fvoska

FUCK!!!

kuanox avatar May 31 '17 17:05 kuanox

  1. Moving @angular/cli to dependencies is wrong, it belongs to devDependencies
  2. make sure all your @angular packageas have the same version (apart from @angular/cli)
  3. delete package-lock.json
  4. delete node_modules
  5. npm install

simplicii avatar Jun 01 '17 22:06 simplicii

For those who are still struggling with that error Follow this guide step-by-step Updating Angular CLI Just do it thoroughly and double recheck your package.json dependencies before invoking npm install.

p0ma avatar Jun 08 '17 19:06 p0ma

My fix:

  • delete node_modules
  • npm cache clean --force
  • npm install Up and running! P.s: Moving @angular/cli to dependencies is wrong, it belongs to devDependencies

ErvinLlojku avatar Jun 20 '17 11:06 ErvinLlojku

My fix was to set production to false and after that local npm install sudo npm config set -g production false npm install

iuuuuan avatar Jun 24 '17 10:06 iuuuuan

{ "name": "orderflow2", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^4.0.0", "@angular/common": "^4.0.0", "@angular/compiler": "^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", "core-js": "^2.4.1", "rxjs": "^5.1.0", "webpack": "^3.2.0", "zone.js": "^0.8.4" }, "devDependencies": { ** THESE TWO ENTRIES RESOLVED THE ERROR

"@angular/cli": "^1.2.0", "@angular/compiler-cli": "^4.0.0",

** "@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" } }

phanik-businesscentral avatar Jul 12 '17 14:07 phanik-businesscentral

  • remove node_modules
  • npm install
  • npm update
  • ng serve Will Work :D

ahmagdy avatar Jul 15 '17 16:07 ahmagdy

i just use this command and its work npm install -g @angular/cli

abdallahmaali avatar Jul 20 '17 05:07 abdallahmaali

Finally found the solution see the below screenshots and steps to resolve this issue http://itechiesol.blogspot.com/2017/07/angular-compiler-cli-package-was-not.html

naru6be avatar Jul 22 '17 17:07 naru6be

@naru6be 's solution worked for me after trying and failing with uninstall /reinstall

ghost avatar Jul 24 '17 18:07 ghost

Thanks for your appreciation graycube

naru6be avatar Jul 25 '17 04:07 naru6be

This works like magic

npm install --save-dev del

blinks32 avatar Aug 04 '17 17:08 blinks32