nx: No longer able to run ng build, with or without migrated workspace on >13.0.0

Current Behavior

When upgrading from NX 12.10.0, to 13.0.0, 13.1.0 or 13.1.1, I am no longer able to run ng build commands on CI. When trying to do ./node_modules/.bin/nx run project:build:production I get the same results.

I seem to only have this issue on CI and have tried replicating the issue locally using the same docker container etc with various results. After migration of the workspace to use project.json files, the error I get is that the version of angular.json should be v1.

Expected Behavior

Builds should continue to run.

Steps to Reproduce

I’m somewhat unsure how to reproduce this exactly and I intend to update this issue as I’m able to debug more and collect more information but I’ve already been trying to diagnose this for the last 2 days confirming that it is indeed nrwl/nx that is the issue. Please see comment below for public repository: https://github.com/nrwl/nx/issues/7536#issuecomment-954680567

Starting from 12.10.0, if I upgrade to 13.1.0 using nx migrate 13.1.0, and then running build everything works locally but gives the issue stated on CI (no output, no log). If I then migrate the workspace as stated in the blog to use multiple project.json files, I get the same error in CI (no output, no log), however locally I get the error that angular.json should be v1?

Failure Logs

There is no output, the command fails silently and even exits 0 but runs in less than a second and produces nothing in the dist folder.

Environment

Node : 14.18.1 OS : linux x64 yarn : 1.22.15

nx : 13.1.1 @nrwl/angular : 13.1.1 @nrwl/cli : 13.1.1 @nrwl/cypress : 13.1.1 @nrwl/devkit : 13.1.1 @nrwl/eslint-plugin-nx : 13.1.1 @nrwl/express : 13.1.1 @nrwl/jest : 13.1.1 @nrwl/linter : 13.1.1 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : 13.1.1 @nrwl/nx-cloud : Not Found @nrwl/react : Not Found @nrwl/schematics : Not Found @nrwl/tao : 13.1.1 @nrwl/web : Not Found @nrwl/workspace : 13.1.1 @nrwl/storybook : 13.1.1 @nrwl/gatsby : Not Found typescript : 4.3.5

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 19 (3 by maintainers)

Most upvoted comments

This fix also resolves our issues. Thanks a lot @internalsystemerror @leosvelperez @Coly010 !

OK. I think I’ve finally managed to recreate the issue by somewhat replicating our modules setup, so I believe it is here that the problem lies. We have an app module which contains no components but configures a library module. The index.html then calls a shell component (which is also bootstrapped in the app module) from this library.

Repository URL: https://gitlab.com/creativecow/nrwl-nx-13-test/ Merge Request: https://gitlab.com/creativecow/nrwl-nx-13-test/-/merge_requests/1

v12.10.0 Branch (main): https://gitlab.com/creativecow/nrwl-nx-13-test/-/tree/main Pipeline (passes): https://gitlab.com/creativecow/nrwl-nx-13-test/-/pipelines/398250187

v13.1.2 Branch (upgrade-to-13): https://gitlab.com/creativecow/nrwl-nx-13-test/-/tree/upgrade-to-13 Pipeline (fails): https://gitlab.com/creativecow/nrwl-nx-13-test/-/pipelines/398257840

You should be able to fork this repository as your own user and it contains the necessary .gitlab-ci.yml to trigger the builds for the main branch and any merge requests to the main branch.

@Coly010

I have confirmed this fix resolves this issue using the test repo above. Many thanks.

Hi, I was trying to migrate our repository to use workspace.json and end up having a similar issue. Our CI uses the print-affected command and it seems that because the workspace.json does not exist in master, it’s unable to calculate the affected projects. Any suggestions on how to tackle this?

Note that the build seems to work when we just upgrade to NX13, but migrating to workspace.json and project.json breaks the build.

Edit: I can trigger my builds if I keep the file as angular.json. However, by doing that, the NX Console schematics cease to work.

This isn’t only isolated to NX apps with Angular. Also occurs with my React apps going through gitlab.

Also having this issue. We’re dead in the water (unless I can figure out how to revert the changes) until this gets fixed!

Update: Reverted to 12.10.