nx icon indicating copy to clipboard operation
nx copied to clipboard

Error: [readCachedProjectGraph] ERROR: No cached ProjectGraph is available

Open njsokol opened this issue 6 months ago • 7 comments

Current Behavior

We are trying to use Nx just to do linting or even sometimes building running normal pnpm exec nx run-many -t lint or build commands and they fail with this error

Error: [readCachedProjectGraph] ERROR: No cached ProjectGraph is available.

If you are leveraging \`readCachedProjectGraph()\` directly then you will need to refactor your usage to first ensure that
the ProjectGraph is created by calling \`await createProjectGraphAsync()\` somewhere before attempting to read the data.

If you encounter this error as part of running standard \`nx\` commands then please open an issue on https://github.com/nrwl/nx
    at readCachedProjectGraph (/home/myname/workspace/SFE-UX-Common-4/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/project-graph/project-graph.js:44:15)
    at run (/home/myname/workspace/SFE-UX-Common-4/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/command-line/run/run.js:173:69)
    at process.<anonymous> (/home/myname/workspace/SFE-UX-Common-4/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/bin/run-executor.js:59:48)
    at process.emit (node:events:518:28)
    at process.emit (/home/myname/workspace/SFE-UX-Common-4/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/native/index.js:20:23)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

### Expected Behavior

Would expect to be able to run these commands and have no issues

### GitHub Repo

_No response_

### Steps to Reproduce

1.


### Nx Report

```shell
Node           : 20.12.2
OS             : linux-x64
Native Target  : x86_64-linux
pnpm           : 8.15.8

nx                 : 20.7.2
@nx/js             : 20.7.2
@nx/jest           : 20.7.2
@nx/eslint         : 20.7.2
@nx/workspace      : 20.7.2
@nx/cypress        : 20.7.2
@nx/devkit         : 20.7.2
@nx/eslint-plugin  : 20.7.2
@nx/playwright     : 20.7.2
@nx/plugin         : 20.7.2
@nx/storybook      : 20.7.2
@nx/vite           : 20.7.2
@nx/web            : 20.7.2
typescript         : 5.3.3
---------------------------------------
Registered Plugins:
@nx/storybook/plugin
@nx/eslint/plugin
@nx/playwright/plugin
---------------------------------------
Local workspace plugins:
         @sfe/workspace-plugin
---------------------------------------
Cache Usage: 214.53 KB / 100.69 GB

Failure Logs


Package Manager Version

pnpm 8.15.8

Operating System

  • [x] macOS
  • [x] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

We have tried the latest version of nx and still failing. This was seen by going from my 20.0.3 -> 20.6.x || 20.7.x

njsokol avatar Apr 10 '25 13:04 njsokol