Angular-cli: @angular/cli is not properly installed

Created on 7 Jun 2017  路  11Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

@angular/cli: 1.1.0
node: 7.5.0
os: darwin x64
@angular/common: error
@angular/compiler: error
@angular/core: error
@angular/forms: error
@angular/http: error
@angular/platform-browser: error
@angular/platform-browser-dynamic: error
@angular/router: error
@angular/cli: 1.1.0
@angular/compiler-cli: error

macOS Sierra

Repro steps.

https://github.com/irimsirrom/mean-stack-base/angular-serve
ng-serve

The log given by the failure.

The "@angular/compiler-cli" package was not properly installed.
Error: The "@angular/compiler-cli" package was not properly installed.
at Object. (/Users/miristoner/GitHub/mean-stack-base/angular-src/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. (/Users/miristoner/GitHub/mean-stack-base/angular-src/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)

Desired functionality.

ng serve to serve

Most helpful comment

@irimsirrom not sure if you're using NPM 5 but that's the case for me and after doing some research, removing BOTH package-lock.json and node_modules/

rm -rf package-lock.json node_modules && npm install

fixed the issue for me.

All 11 comments

Link is broken.

@irimsirrom Looks like you are using the old version of CLI still in package.json please update that to and check. https://github.com/irimsirrom/mean-stack-base/blob/master/angular-src/package.json#L33

Having the same error with latest (1.1.2)

@angular/cli: 1.1.2
node: 8.1.2
os: linux x64
@angular/animations: error
@angular/common: error
@angular/compiler: error
@angular/core: error
@angular/forms: error
@angular/http: error
@angular/platform-browser: error
@angular/platform-browser-dynamic: error
@angular/router: error
@angular/cli: 1.1.2
@angular/compiler-cli: 4.2.3
{
  "name": "my-project",
  "version": "1.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": {
    "@agm/core": "^1.0.0-beta.0",
    "@angular/animations": "^4.2.3",
    "@angular/common": "^4.2.3",
    "@angular/compiler": "^4.2.3",
    "@angular/core": "^4.2.3",
    "@angular/forms": "^4.2.3",
    "@angular/http": "^4.2.3",
    "@angular/platform-browser": "^4.2.3",
    "@angular/platform-browser-dynamic": "^4.2.3",
    "@angular/router": "^4.2.3",
    "@ngx-translate/core": "^7.0.0",
    "@ngx-translate/http-loader": "0.1.0",
    "angular2-notifications": "^0.7.4",
    "angular2-recaptcha": "^0.6.0",
    "bootstrap-sass": "^3.3.7",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.4.1",
    "jquery": "^3.2.1",
    "rxjs": "^5.4.1",
    "web-animations-js": "^2.2.5",
    "zone.js": "^0.8.12"
  },
  "devDependencies": {
    "@angular/cli": "^1.1.2",
    "@angular/compiler-cli": "^4.2.3",
    "@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",
    "typescript": "~2.3.4"
  }
}
tsc --version                                                                                                                                                                           
Version 2.3.4

@irimsirrom not sure if you're using NPM 5 but that's the case for me and after doing some research, removing BOTH package-lock.json and node_modules/

rm -rf package-lock.json node_modules && npm install

fixed the issue for me.

I have the same issue. @philippeboyd workaround works, but it's cumbersome for people that have meaningful package-lock.json

Closing as answered by @sumitarora. If your package-lock.json includes invalid versions, it makes sense that you also have to update it somehow.

@filipesilva this happens during normal angular-cli upgrade. Following the recommended instructions does not work if I have a package-lock.json:
(the instructions are:

rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install

)

Deleting package-lock.json is required, but will cause problems if I rely on it for locking packages other then angular-cli (valid versions).

I was able to solve by these codes:
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install

Getting below error while installing angular-cli
.
.
.

21741 error Windows_NT 10.0.10240
21742 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "angular-cli"
21743 error node v6.11.2
21744 error npm v3.10.10
21745 error shasum check failed for C:\Users\e3018884\AppData\Local\Temp\npm-13396-5bc613c4\registry.npmjs.org\tar-\tar-2.2.1.tgz
21745 error Expected: 8e4d2a256c0e2185c6b18ad694aec968b83cb1d1
21745 error Actual: f7ceb02fae8108dbd25be417b8db7f271f082159
21745 error From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
21746 error If you need help, you may report this error at:
21746 error https://github.com/npm/npm/issues
21747 verbose exit [ 1, true ]

could anyone help on this?

Below command worked for me. ,ay be -f option did the trick here.
npm install -g -f @angular/cli

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

delasteve picture delasteve  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

NCC1701M picture NCC1701M  路  3Comments

sysmat picture sysmat  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments