Angular-cli: CLI 1.5.0-beta.0 global installation fails

Created on 14 Sep 2017  路  10Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

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

Versions.


Node 8.5.0
NPM 5.3.0
OSX 10.12.6

Repro steps.


npm install @angular/cli@next then ng -v

The log given by the failure.

Error: The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler-cli'
    at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/index.js:14:11)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/commands/build.js:6:19)
    at Module._compile (module.js:624:30)

Desired functionality.


It looks like this person ran into the same error. https://github.com/angular/angular-cli/issues/7515 I deleted my global node modules and reinstalled node/npm to be certain but still get the error. If I run npm install -g @angular/cli@latest 1.4.2 successfully installs. I'll try on my Windows machine next see if I replicate it.

0 (critical) bufix

Most helpful comment

The error says Cannot find module '@angular/compiler-cli' which is indeed missing from %appdata%\npm\node_modules\@angular\cli\node_modules

I manually added the missing module from the node_modules folder in windows with:
cd %appdata%\npm\node_modules\@angular\cli\node_modules
npm install @angular\compiler-cli@next --save
Then I had to also:
npm install @angular\compiler@next --save

And then ng --version started working. Seems like it might be a packaging issue?

angular/cli: 1.5.0-beta.0
node: 6.9.1
os: win32 x64
angular/compiler: 5.0.0-beta.7
angular/compiler-cli: 5.0.0-beta.7
ngtools/json-schema: 1.1.0
ngtools/webpack: 1.8.0-beta.0
typescript: 2.5.2

All 10 comments

I get the same issue on a Windows box, also tried deleting the node_modules folder to no avail

The error says Cannot find module '@angular/compiler-cli' which is indeed missing from %appdata%\npm\node_modules\@angular\cli\node_modules

I manually added the missing module from the node_modules folder in windows with:
cd %appdata%\npm\node_modules\@angular\cli\node_modules
npm install @angular\compiler-cli@next --save
Then I had to also:
npm install @angular\compiler@next --save

And then ng --version started working. Seems like it might be a packaging issue?

angular/cli: 1.5.0-beta.0
node: 6.9.1
os: win32 x64
angular/compiler: 5.0.0-beta.7
angular/compiler-cli: 5.0.0-beta.7
ngtools/json-schema: 1.1.0
ngtools/webpack: 1.8.0-beta.0
typescript: 2.5.2

@Confusedfish's solution solved the problem for me, cleaning up the modules haven't.

The problem is still in 1.5.0-beta.1

  • @angular/[email protected]
    added 121 packages, removed 7 packages, updated 33 packages and moved 6 packages

ng -v

Error: The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler-cli'

As many people, I also can't install any of the 1.5 betas (node 8.5.0, npm 5.3, 0SX 10.12.6).

@hansl I see you're assigned, but the issue has no label, is it normal?

@cexbrayat Looks like you won't be able to install beta.2 as well

Yes, same problem with beta.2

I tried with OSX 10.12.6, node 6.11.3, npm 3.10.10 and same problem
I tried with Yarn or NPM defined as the packageManager and same problem.

@hansl @Brocco any idea on this?

Heya all, sorry for this problem being around for so long.

Getting this error while using ng -v outside of a project is due to the CLI improperly loading @ngtools/webpack outside of build commands.

It should have been caught by our CI but something is wrong in our setup, I'm investigating.

I have a fix being tested in https://github.com/angular/angular-cli/pull/7905.

Meanwhile, the workaround is globally install @angular/compiler-cli. Sorry about this.

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