Angular-cli: CLI update issues

Created on 9 Jun 2017  路  12Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Updating CLI from 1.0.0 to >1.1.0 or above throws error and does not install the compiler-cli properly on windows 10

Versions.

@angular/cli: 1.1.1
node: 6.10.3
os: win32 x64
@angular/animations: 4.2.0
@angular/common: 4.2.0
@angular/compiler: 4.2.0
@angular/compiler-cli: 4.2.0
@angular/core: 4.2.0
@angular/forms: 4.2.0
@angular/http: 4.2.0
@angular/platform-browser: 4.2.0
@angular/platform-browser-dynamic: 4.2.0
@angular/router: 4.2.0
@angular/cli: 1.1.1
@angular/language-service: 4.2.0

Repro steps.

Update a project from angular cli 1.0.0 to latest version on windows:

rm -rf node_modules dist
npm install --save-dev @angular/cli@latest
npm install

The log given by the failure.

@angular/compiler-cli does not install properly, it needs to be reinstalled. (throws error: compiler-cli was not installed properly)

Additionally throw error on install and when installing new packages:

Error: Cannot find module 'code-point-at'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\ng\test-project-ng4\node_modules\wide-align\node_modules\string-width\index.js:3: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)
2 (required) broken

All 12 comments

@Ploppy3 no one else has reported this issue... can you retry please. I was just able to walk through this scenario successfully. (I admit that I do not have a windows environment).

Unfortunately I don't have any project to update anymore, all 3 of them broke in the same way described above. Though, between projects' update I updated npm to the latest hotfix to check if it was related to npm, then I installed the latest version of node for the same reason but still the next projects broke.

The only thing I used in the project other than the tools you provide in the CLI was npm-check-updates. Could it be related in any way?

Talking about that. What's the proper way to update the dependencies of a cli project? Do you work on a tool to do this automatically? Right now the only solution I found is to create a new empty project and copy the parts of package.json that I need.

After much more investigation it seems that npm 5 is the root of the problem. The introduction of the package-lock.json seems to create many of the issues I'm getting. I can't tell if it's only npm5 or the combination of the cli and npm as I'm only using npm for angular.

I reinstalled npm & node completely, both up to date to the latest version and the problem persist.

Try delete _node_modules_ and _package-lock.json_, run npm install again.

I realized too that deleting the package-lock.json fixes the issue momentarily. Just until the next time you use npm.

@Brocco Is it possible that the 'code-point-at' package is a missing dependency ?

Adding it to the dev dependencies fixes some issues that I get.

I'm having a similar problem. Just globally reinstalled the latest Angular CLI and typescript. Started a fresh "ng new", and when I "ng serve" I get the angular cli compiler error. I haven't updated Node for a few months.

As @Ploppy3 mentioned package-lock.json is a real pain. It will prevent anything from updating. You can change a package version in package.json but nmp i will ignore it until you delete the lock file. And it wasn't the issue with the older versions of npm.

Restarting my computer fixed the issue for some reason.

NPM 5.1 was release recently and seems to have many bug-fixes related to the lock file.

I couldn't test yet on a new project but I successfully managed to install updates of angular packages, please try and tell me if it helps.

@brandonwilliams this is insane... it did work after restarting :(

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