angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

"Cannot read property '1' of null" when running `ng update` using cli 1.7.3

Open IgorMinar opened this issue 8 years ago • 8 comments

Versions

Angular CLI: 1.7.3
Node: 8.9.4
OS: darwin x64
Angular: 6.0.0-rc.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Repro steps

  • ng update

Observed behavior

$ ng update
Error: Cannot read property '1' of null
Cannot read property '1' of null
error Command failed with exit code 1.

Desired behavior

It seems that the currently expected user flow is for users to

  • manually update the package.json for @angular/cli to ^6.0.0-rc.0
  • run yarn/npm update
  • and then run ng update @angular/cli --migrate-only --from=1.7.3

If nothing else, we should at least point people to an upgrade document describing the expected steps and commands to run. Cannot read property '1' of null is not a good user experience.

Mention any other details that might be useful (optional)

IgorMinar avatar Apr 03 '18 18:04 IgorMinar

So pre-6.0 final we should properly show instructions to manually update. As soon as 6.0 lands we should take some time to fix 1.7 to support the update schematic fully (as a non breaking change).

hansl avatar Apr 05 '18 17:04 hansl

I tried several combinations of ng update using global, local, CLI 1.7.3, 1.7.4, Angular 5, Angular 6 and could not see this message. I always had CLI 6.0.0-rc.2 installed globally while testing.

I think this was something with our schematics commands that we inadvertently fixed in rc.2.

If this problem comes up again I will reopen.

filipesilva avatar Apr 06 '18 15:04 filipesilva

Angular CLI: 1.7.4 Node: 8.11.1 OS: darwin x64 Angular: 5.2.10 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

ng update --next
Your global Angular CLI version (6.0.0-rc.3) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Error: Cannot read property '1' of null
Cannot read property '1' of null

I tried the update command today, I am getting the same message.

Tried the "Desired behavior" flow, but getting the same there after the steps

ng update @angular/cli --migrate-only --from=1.7.4 --next
Your global Angular CLI version (6.0.0-rc.3) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
The option '--migrate-only' is not registered with the update command. Run `ng update --help` for a list of supported options.
The option '--from' is not registered with the update command. Run `ng update --help` for a list of supported options.
Error: Cannot read property '1' of null
Cannot read property '1' of null

eXXeption avatar Apr 19 '18 13:04 eXXeption

Having the same problem as @eXXeption

ng update --next
Your global Angular CLI version (6.0.0-rc.5) is greater than your local
version (1.7.3). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Error: Cannot read property '1' of null
Cannot read property '1' of null

fishgills avatar Apr 24 '18 17:04 fishgills

This problem appeared for me in stable version too.

$ ng update --next

Your global Angular CLI version (6.0.0) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Error: Cannot read property '1' of null
Cannot read property '1' of null

nihanth007 avatar May 06 '18 03:05 nihanth007

I also encountered this issue. The steps listed in the "Desired Behavior" section of Igor's original post worked. Here they are for those looking for a solution in the comments:

  • manually update the package.json for @angular/cli to ^6.0.0-rc.0
  • run yarn/npm update
  • and then run ng update @angular/cli --migrate-only --from=1.7.3

vincecampanale avatar May 11 '18 14:05 vincecampanale

It happened for me because I had package-lock.json still in the app. remove the package-lock.json then ng update @angular/cli

mahdikianirad avatar Jun 28 '18 08:06 mahdikianirad

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.