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

I have the same issue, but running node 6.10.1 on the same environment and using angular version 4.

Werner-Swart-83 avatar Mar 25 '17 21:03 Werner-Swart-83

Having a exact same issue.

shumbo avatar Mar 26 '17 03:03 shumbo

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

cdibbs avatar Mar 26 '17 04:03 cdibbs

Updated my local typescript to latest and changed my tsconfig.json to tsconfig.app.json and everything worked again.

Werner-Swart-83 avatar Mar 26 '17 06:03 Werner-Swart-83

I am having the same problem, and updating typescript and changing tsconfig.json to tsconfig.app.json did not help.

The "@angular/compiler-cli" package was not properly installed. Error: The "@angular/compiler-cli" package was not properly installed. at Object. (/Users/daniel/Documents/globati/code/MemberAdmin/node_modules/@ngtools/webpack/src/index.js:14: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. (/Users/daniel/Documents/globati/code/MemberAdmin/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)

package.json

{
  "name": "member-admin",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "postinstall": "typings install",
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.3.1",
    "@angular/compiler": "^2.3.1",
    "@angular/core": "^2.3.1",
    "@angular/forms": "^2.3.1",
    "@angular/http": "^2.3.1",
    "@angular/platform-browser": "^2.3.1",
    "@angular/platform-browser-dynamic": "^2.3.1",
    "@angular/router": "~3.1.0",
    "angular-calendar": "^0.4.0",
    "angular2-datatable": "^0.5.2",
    "angular2-google-maps": "^0.16.0",
    "bootstrap-datepicker": "^1.6.4",
    "bootstrap-timepicker": "^0.5.2",
    "core-js": "^2.4.1",
    "mydatepicker": "^1.7.7",
    "ng2-datepicker": "^1.8.2",
    "ng2-datetime": "^1.2.2",
    "ng2-file-upload": "^1.1.4-2",
    "rxjs": "5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0",
    "@types/jasmine": "^2.2.30",
    "@types/jquery": "^2.0.34",
    "@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",
    "typings": "1.0.4",
    "webdriver-manager": "10.2.5"
  }
}

danielptm avatar Mar 26 '17 13:03 danielptm

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

intellix avatar Mar 26 '17 14:03 intellix

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

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

version was the same as my other dependencies.

danielptm avatar Mar 26 '17 14:03 danielptm

I have the same error with a new empty project that i am trying to deploy on heroku so this isn't an upgrade problem:

@angular/cli: 1.0.0
node: 6.10.1
os: linux x64
@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
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.0

Executing ng build after installing deps with npm

The "@angular/compiler-cli" package was not properly installed.
Error: The "@angular/compiler-cli" package was not properly installed.
    at Object.<anonymous> (/tmp/build_cbb06fd66b6910b71eeba0a0f3c62096/.heroku/node/lib/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> (/tmp/build_cbb06fd66b6910b71eeba0a0f3c62096/.heroku/node/lib/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)

Executing ng build after installing deps with yarn

remote: The "@angular/compiler-cli" package was not properly installed.
remote: Error: The "@angular/compiler-cli" package was not properly installed.
remote:     at Object.<anonymous> (/app/.config/yarn/global/node_modules/@ngtools/webpack/src/index.js:14:11)
remote:     at Module._compile (module.js:570:32)
remote:     at Object.Module._extensions..js (module.js:579:10)
remote:     at Module.load (module.js:487:32)
remote:     at tryModuleLoad (module.js:446:12)
remote:     at Function.Module._load (module.js:438:3)
remote:     at Module.require (module.js:497:17)
remote:     at require (internal/module.js:20:19)
remote:     at Object.<anonymous> (/app/.config/yarn/global/node_modules/@angular/cli/tasks/eject.js:10:19)
remote:     at Module._compile (module.js:570:32)
remote:     at Object.Module._extensions..js (module.js:579:10)
remote:     at Module.load (module.js:487:32)
remote:     at tryModuleLoad (module.js:446:12)
remote:     at Function.Module._load (module.js:438:3)
remote:     at Module.require (module.js:497:17)
remote:     at require (internal/module.js:20:19)

codestation avatar Mar 26 '17 16:03 codestation

@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

intellix avatar Mar 26 '17 17:03 intellix

Thanks, that was the problem. Moved cli, compiler-cli and typescript out of devDeps and it worked.

codestation avatar Mar 26 '17 17:03 codestation

@intellix where i put that code pleas ???

elversace avatar Mar 26 '17 18:03 elversace

@elversace - If you're deploying to Heroku, add it to dependencies, otherwise add it to devDependencies inside package.json. ...or go to console and: npm install --save @angular/compiler-cli

Created a blog post about Heroku deployments.

intellix avatar Mar 26 '17 19:03 intellix

A long litany of comments. Still, I am not sure what the I need to do with respect to my initial posting???

rfball avatar Mar 26 '17 21:03 rfball

@rfball npm install --save @angular/compiler-cli

intellix avatar Mar 26 '17 21:03 intellix

@intellix Thanks for the quick response! Just tried this but this is a long list of "UNMET PEER DEPENDENCIES" . Is there a way to do something like the following, in order to start form scratch. 1 fix the package.json (and/or other files) 2 remove any existing files 3 reinstall from scratch Thanks for your help!

rfball avatar Mar 26 '17 22:03 rfball

OK,

  1. I completely removed the node_modules directory (rm -rf node_modules dist),
  2. Changed the package.json to match the "dependencies" and "devDependencies" as shown in comment by @intellix above.
  3. Fixed the angular-cli.json file for changes in the environment configs (as listed in diagnostics from first time I ran ng serve after the install).

I am up and running. Hoping for smooth sailing. Thanks again for the help. Closing this one now. :)

rfball avatar Mar 26 '17 23:03 rfball

Same error here after upgrading to angular-cli 1.0, fixed by upgrading typescript to 2.2.0

Toub avatar Mar 27 '17 09:03 Toub

Moving from devDeps to dependencies as @intellix said make npm start (ng serve) work, but... Are you sure about to use angular-cli? I moved to angular/cli and it seems that everything is working fine.

Everything? Chrome sais in some pages

ERROR Error: Uncaught (in promise): Error: Found the synthetic property @showFilterList. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application. Error: Found the synthetic property @showFilterList. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.

jjorbas avatar Mar 30 '17 09:03 jjorbas

I forgot to link to the blog post for CLI in Heroku, here it is: https://medium.com/@intellix/production-ready-angular-cli-in-heroku-4bcdc8322550

@jjorbas you need to import BrowserAnimationsModule into AppModule

intellix avatar Mar 30 '17 09:03 intellix

Here's what worked for me: 1.) Followed the Updating Angular CLI section here 2.) Deleted node_modules folder 3.) Moved these from devDependencies to dependencies:

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

4.) npm install

kylefloros avatar Apr 01 '17 14:04 kylefloros