Angular-cli: update: Data path ".from" should be string.

Created on 13 Apr 2018  Â·  12Comments  Â·  Source: angular/angular-cli

Versions

Angular CLI: 6.0.0-rc.4
Node: 8.10.0
OS: darwin x64
Angular: 6.0.0-rc.4
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.5.5
@angular-devkit/build-angular     0.5.5
@angular-devkit/build-optimizer   0.5.5
@angular-devkit/core              0.5.5
@angular-devkit/schematics        0.5.6
@angular/cdk                      6.0.0-rc.2
@angular/flex-layout              5.0.0-beta.13
@angular/material                 6.0.0-rc.2
@ngtools/json-schema              1.1.0
@ngtools/webpack                  6.0.0-rc.3
@schematics/angular               0.5.6
@schematics/update                0.5.6
rxjs                              5.5.10
typescript                        2.7.2
webpack                           4.5.0

Repro steps

  • Step 1 - Install CLI rc.4 and see this message
================================================================================
An old CLI configuration has been detected, which needs to be updated to the latest version.

Please run the following command to update this workspace:
  ng update @angular/cli --migrate-only --from=1
================================================================================
  • Step 2 - Run ng update @angular/cli --migrate-only --from=1 as suggested and get this error
Schematic input does not validate against the Schema: {"dryRun":false,"migrateOnly":true,"from":1,"force":false,"all":false,"next":false,"registry":"http://registry.npmjs.org/"}
Errors:

  Data path ".from" should be string.
  • Step 3 - Run ng update @angular/cli --migrate-only --from="1" and get the same error
  • Step 4 - Run ng update @angular/cli --migrate-only --from='1' and get the same error

Desired behavior

The command recommended by the CLI message should run without error.

Mention any other details that might be useful (optional)

N/A

Most helpful comment

ng update @angular/cli --migrate-only --from=1.7.4 seemed to work, but it is not what was recommended. I was upgrading from Angular CLI 6.0.0-beta.5.

All 12 comments

Me too getting same error.

ng update @angular/cli --migrate-only --from=1.7.4 seemed to work, but it is not what was recommended. I was upgrading from Angular CLI 6.0.0-beta.5.

ng update @angular/cli --migrate-only --from=1.7.4 not work

The nodejs module used behind the scene to get command line parameters is probably wrongly casting --from=1 to boolean instead of keeping it as a string.

ng update @angular/cli --migrate-only --from=1.7.4 just worked for me

Use your previous version of angular-cli instead of 1 for the --from attribute.
So it would look something like this.
ng update @angular/cli --migrate-only --from=<previous_version_of_cli>
The new angular cli doesnt have angular-cli.json, it is replaced by angular.json.

Yes it looks like our arg parsing isn't reading --from=1 as a number. There is a fix incoming in https://github.com/angular/angular-cli/pull/10315. Sorry about that :/

after above command, it generates a new error while build or serve application
Cannot read property 'config' of null

Hi, as I understand fix is in new build, but what I should do now to move forward?

When I do
ng update @angular/cli --migrate-only
Updating package.json with dependency @angular/cli @ "1.7.4" (was "1.5.0")...

but ng server still is giving a problem-related cli version

I tried
[mariusz admin.angular5]$ ng update @angular/cli --migrate-only --from=1.5.0
/Users/mariusz/dev/selenium_testing_portal/projects/admin.angular5>
[mariusz admin.angular5]$ ng update @angular/cli --migrate-only --from="1.5.0"
/Users/mariusz/dev/selenium_testing_portal/projects/admin.angular5>

but those look like no effect

my current config

[mariusz admin.angular5]$ ng --version

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ â–³ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/

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

Package Version

@angular-devkit/architect 0.5.6 (cli-only)
@angular-devkit/core 0.5.6 (cli-only)
@angular-devkit/schematics 0.5.6 (cli-only)
@angular/cli
@schematics/angular 0.5.6 (cli-only)
@schematics/update 0.5.6 (cli-only)
rxjs 5.5.10
typescript 2.7.2 (cli-only)

Thank you for suggestion

@mantonik I would try ng update @angular/cli --migrate-only --from=1.7.4 and if that doesn't work, try upgrading to 1.7.4, getting things working, and then re-running the update command with 6.0.0-rc.4.

@Brocco @filipesilva @hansl #10315 didn't correctly fixed this issue.

The option is not converting anymore into a boolean, but it's still converting into a number. So:

  • ng update @angular/cli --migrate-only --from=1.7.4 works

But following doesn't work:

  • ng update @angular/cli --migrate-only --from=1.7
  • ng update @angular/cli --migrate-only --from=1

And when updating the CLI, the CLI explicitly says to do the last option (from 1), so a lot of people will run into this issue.

The fix referenced (#10315) has not yet been released and because both 1 and 1.7 can both be parsed as numbers that is what is happening. The fix will respect the option's declared type and parse those values as strings even though they could be parsed as numbers.

Thanks for your vigilance in testing these issues.

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