nx: Trying to run any build after 12.3.5 migration results in registry.useXDeprecatedProvider is not a function

Current Behavior

ng build fails

Expected Behavior

ng build still works after migration

Steps to Reproduce

  1. nx migrate 12.3.5
  2. npm i
  3. nx migrate --run-migrations
  4. ng build --configuration=staging

If I downgrade to 12.3.4, this works fine. It also worked fine on the previous version we were on (12.3.1).

Failure Logs

> nx run xlts-dev:build:staging
registry.useXDeprecatedProvider is not a function

Environment

  Node : 14.16.1
  OS   : darwin x64
  npm  : 6.14.13
  
  nx : Not Found
  @nrwl/angular : 12.3.5
  @nrwl/cli : 12.3.5
  @nrwl/cypress : 12.3.5
  @nrwl/devkit : 12.3.5
  @nrwl/eslint-plugin-nx : 12.3.5
  @nrwl/express : Not Found
  @nrwl/jest : 12.3.5
  @nrwl/linter : 12.3.5
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.3.5
  @nrwl/web : Not Found
  @nrwl/workspace : 12.3.5
  @nrwl/storybook : Not Found
  @nrwl/gatsby : Not Found
  typescript : 4.2.4

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (6 by maintainers)

Most upvoted comments

OK, thank you for helping investigate and solve this!

You can disregard it for now, it’s just a warning which is appearing now precisely because we added the useXDeprecatedProvider to warn about deprecations, but it seems we might be passing the default values to the scheduled target as if they were specified by the dev in the config. I’ll have a look to correct that tomorrow.

Yeah, it seems to be working now. Since @nrwl/tao doesn’t have a dependency on @angular-devkit/core, this kind of thing can happen pretty easily when there are a lot of different versions of it due to different libraries and tools. It usually results in very hard to understand errors. The Angular CLI team is aware that this kind of problem exists and it keeps coming back up again and again. I think that they have a design for a solution and are working towards getting there at some point in the future.

It’s not as simple as you seem to be interpreting it. I don’t think that it has anything to do with a bad migration. All of the Angular packages in my package.json are 12.0.2.

I can try to regenerate my package-lock.json.

@Splaktar thanks for reporting this!

I tried to reproduce this issue in 2 ways:

  • Creating a 12.3.1 workspace and migrating it to 12.3.5.
  • Creating a 12.3.5 workspace.

In both scenarios the build worked well, I was not able to reproduce the problem. This seems weird, this is the line that could cause it https://github.com/nrwl/nx/blob/master/packages/tao/src/commands/ngcli-adapter.ts#L53, but the useXDeprecatedProvider is a function defined in the CoreSchemaRegistry as it can be seen here https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/core/src/json/schema/registry.ts#L627.

You can see here https://github.com/angular/angular-cli/blob/c1512e4274/packages/angular/cli/models/architect-command.ts#L42 the same thing is done by the Angular CLI to initialize the registry before running a builder.

Could you share a reproduction of the issue so we can have a look?

Please note 12.3.4 has issues with CI which were solved in 12.3.5.