nx: Build failure when NX_CACHE_PROJECT_GRAPH = false

Current Behavior

With NX_CACHE_PROJECT_GRAPH = false, readCachedProjectGraph no longer works and fails build

Expected Behavior

With NX_CACHE_PROJECT_GRAPH = false, either recompute project graph to calculate generatePackageJson, or do not throw an error.

Previously with NX_CACHE_PROJECT_GRAPH=false, I was able to build projects

Steps to Reproduce

Remove node_modules/.cache folder. Run NX_CACHE_PROJECT_GRAPH=false nx affected:build

Failure Logs

[AWS CodeBuild Plugin]       [readCachedProjectGraph] ERROR: No cached ProjectGraph is available.
[AWS CodeBuild Plugin]       
[AWS CodeBuild Plugin]       If you are leveraging `readCachedProjectGraph()` directly then you will need to refactor your usage to first ensure that
[AWS CodeBuild Plugin]       the ProjectGraph is created by calling `await createProjectGraphAsync()` somewhere before attempting to read the data.
[AWS CodeBuild Plugin] 
[AWS CodeBuild Plugin]       If you encounter this error as part of running standard `nx` commands then please open an issue on https://github.com/nrwl/nx

Environment

yarn nx report
yarn run v1.22.10
$ nx report

>  NX  Report complete - copy this into the issue template

  Node : 14.17.0
  OS   : linux x64
  yarn : 1.22.10
  
  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 12.6.3
  @nrwl/cypress : 12.6.3
  @nrwl/devkit : 12.6.3
  @nrwl/eslint-plugin-nx : 12.6.3
  @nrwl/express : Not Found
  @nrwl/jest : 12.6.3
  @nrwl/linter : 12.6.3
  @nrwl/nest : 12.6.3
  @nrwl/next : Not Found
  @nrwl/node : 12.6.3
  @nrwl/nx-cloud : Not Found
  @nrwl/react : 12.6.3
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.6.3
  @nrwl/web : 12.6.3
  @nrwl/workspace : 12.6.3
  @nrwl/storybook : 12.6.3
  @nrwl/gatsby : Not Found
  typescript : 4.3.5

About this issue

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

Most upvoted comments

@SerdarN92 what I can see on our side is, that everything was fine to 12.6.2, afterwards same error - will dig into it this evening

@pmoehler it worked now with 12.6.2. THANK YOU !!!

@pmoehler thanks for the hint. I will try to downgrade to 12.6.2. I already tried 12.6.5, but i got the same error.

One more interesting fact, that could help you: this error only comes up, when i run builds for nestjs-projects. Angular-projects build without errors.

Locally my build runs without errors.

As soon i do the same on google cloud build, i get the same error:

image

I set the env variable to false in my dockerfile, still this error comes up …

image