angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

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

Closed rfball closed 7 years ago

rfball commented 7 years ago

[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"
  }
}
hodorIsComing commented 6 years ago

I had the same issue and I just solved it. It was related to the location of my new project. I can't create 2 angular-cli projects in the same directory.

This wasn't working for me : I tried to remove node_module and to run npm install, to reinstall @angular/compiler-cli, NOTHING WORKED. My problem was : I was trying to create a new angular-cli project in the same directory as an other angular-cli project (my first project was working). I noticed that running 'ng new my_project' was unuasually quick.

So I created a new folder somewhere else, and ran

ng new project_name cd project_name npm install ng serve

For some reason it works now.

Is it a bug report ? Have you guys suceeded to create several angular-cli projects in the same directory ?

FrancescoBorzi commented 6 years ago

I experienced this issue as well.

I'm not exactly sure how to reproduce it, but this is what happened:

To solve it, I just re-run npm install in project A (even though there wasn't anything new to install)

bluehenry commented 6 years ago

I got this issue after I installed bootstrap@4.0.0-beta. After I ran 'npm install @angular/compiler-cli', the problem is solved. I assume it because bootstrap@4.0.0-beta need other packages for higher version .

hodorIsComing commented 6 years ago

I know a way to reproduce/fix this BUG if you use ATOM.

I found my solution. The 'npm install' was not generating the same folders according to the command prompt I was using (default Windows Command Prompt VS Atom-IDE-Terminal) !!!

FROM THE WINDOWS COMMAND PROMPT : npm install created hundreds of folders in node_module. ng serve then works.

FROM THE ATOM COMMAND PROMPT : npm install is much quicker (bad sign) and only create 10 folders in node_module. ng serve FAILS.

I guess again it has something to do with permissions, and is probably not related to angular-cli.

EDIT : Now trying ng new project_name with default windows command prompt. It's long but ng serve it works.

With ATOM : it's quicker but ng serve doesn't work.

If you are using windows, just check you are using the default command prompt to run npm install. That solved the issue for me

dalidovski commented 6 years ago

Could you check that your "@angular/compiler" in your dependencies is compatible with angular/cli version:

https://stackoverflow.com/a/47328497/2633707

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.