question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR: No cached ProjectGraph is available.

See original GitHub issue

Current Behavior

Random nx crash in our Github CI during a build

Expected Behavior

nx can build our projects without failing

Steps to Reproduce

I guess new messages at the end of #10730 are kinda similar. Looks related to the latest release.

Failure Logs

> nx run generic-dynamodb-orm:build 
Error reading '/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.cache/nx/nxdeps.json'. Continue the process without the cache.
Error: ValueExpected in /home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.cache/nx/nxdeps.json at position 0
    at parseJson (/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/nx@14.4.3_@swc+core@1.2.215/node_modules/nx/src/utils/json.js:23:15)
    at readJsonFile (/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/nx@14.4.3_@swc+core@1.2.215/node_modules/nx/src/utils/fileutils.js:23:37)
    at readCache (/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/nx@14.4.3_@swc+core@1.2.215/node_modules/nx/src/project-graph/nx-deps-cache.js:41:49)
    at readCachedProjectGraph (/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/nx@14.4.3_@swc+core@1.2.215/node_modules/nx/src/project-graph/project-graph.js:20:61)
    at checkDependencies (/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/@nrwl+js@14.4.3_2ufozsgst4bthv2r67rno347d4/node_modules/@nrwl/js/src/utils/check-dependencies.js:7:62)
    at tscExecutor_1 (/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/@nrwl+js@14.4.3_2ufozsgst4bthv2r67rno347d4/node_modules/@nrwl/js/src/executors/tsc/tsc.impl.js:29:111)
    at tscExecutor_1.next (<anonymous>)
    at resume (/home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/tslib@2.4.0/node_modules/tslib/tslib.js:230:48)
    at /home/ubuntu/actions-runner/_work/monorepo/monorepo/node_modules/.pnpm/tslib@2.4.0/node_modules/tslib/tslib.js:229:[125](https://github.com/hublo/monorepo/runs/7410177714?check_suite_focus=true#step:11:126)
    at new Promise (<anonymous>)
 >  NX   [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
   Pass --verbose to see the stacktrace.

Environment

❯ pnx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.15.1
   OS   : darwin arm64
   pnpm : 7.5.0

   nx : 14.4.3
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.4.3
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.4.3
   @nrwl/eslint-plugin-nx : 14.4.3
   @nrwl/express : Not Found
   @nrwl/jest : 14.4.3
   @nrwl/js : 14.4.3
   @nrwl/linter : 14.4.3
   @nrwl/nest : 14.4.3
   @nrwl/next : 14.4.2
   @nrwl/node : 14.4.3
   @nrwl/nx-cloud : 14.2.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.4.3
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.4.3
   @nrwl/web : 14.4.3
   @nrwl/workspace : 14.4.3
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:5
  • Comments:29 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mehrad-rafighcommented, Aug 19, 2022

Same here, CI and local instances crash with the error message

Error reading ‘<redacted>/node_modules/.cache/nx/nxdeps.json’. Continue the process without the cache

npx nx report                                             

 >  NX   Report complete - copy this into the issue template

   Node : 14.19.3
   OS   : linux x64
   npm  : 6.14.17
   
   nx : 14.5.4
   @nrwl/angular : 14.5.4
   @nrwl/cypress : 14.5.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.5.4
   @nrwl/eslint-plugin-nx : 14.5.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.5.4
   @nrwl/js : 14.5.4
   @nrwl/linter : 14.5.4
   @nrwl/nest : 14.5.4
   @nrwl/next : Not Found
   @nrwl/node : 14.5.4
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.5.4
   @nrwl/web : 14.5.4
   @nrwl/workspace : 14.5.4
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
   	 @ngrx/component-store: 14.0.2
   	 @ngrx/effects: 14.0.2
   	 @ngrx/entity: 14.0.2
   	 @ngrx/router-store: 14.0.2
   	 @ngrx/store: 14.0.2
   	 @ngrx/schematics: 14.0.2
   	 @ngrx/store-devtools: 14.0.2
1reaction
B1Z1commented, Sep 2, 2022

@AgentEnder on our CI while Jest Tests run, we got this error. I think we cannot close this ticket because sometimes it shows up. Do you need more information from me? We are struggling with it for several months

Here’s an error

`Error reading ‘/home/ubuntu/workspace/PPM/REVIEW/FRONTEND_TESTS/ui/node_modules/.cache/nx/nxdeps.json’. Continue the process without the cache.

[2022-09-02T13:34:53.235Z] Error: UnexpectedEndOfString in /home/ubuntu/workspace/PPM/REVIEW/FRONTEND_TESTS/ui/node_modules/.cache/nx/nxdeps.json at position 4939768

[2022-09-02T13:34:53.235Z] at parseJson (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/src/utils/json.js:23:15)

[2022-09-02T13:34:53.235Z] at readJsonFile (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/src/utils/fileutils.js:23:37)

[2022-09-02T13:34:53.235Z] at readCache (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/src/project-graph/nx-deps-cache.js:41:49)

[2022-09-02T13:34:53.235Z] at readCachedProjectGraph (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/src/project-graph/project-graph.js:20:61)

[2022-09-02T13:34:53.235Z] at run (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/src/command-line/run.js:168:69)

[2022-09-02T13:34:53.235Z] at requireCli (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/bin/run-executor.js:20:23)

[2022-09-02T13:34:53.235Z] at Object.<anonymous> (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/bin/run-executor.js:14:1)

[2022-09-02T13:34:53.235Z] at Module._compile (node:internal/modules/cjs/loader:1105:14)

[2022-09-02T13:34:53.235Z] at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)

[2022-09-02T13:34:53.235Z] at Module.load (node:internal/modules/cjs/loader:981:32)

[2022-09-02T13:34:53.235Z] Could not find ‘nx’ module in this workspace. Error: [readCachedProjectGraph] ERROR: No cached ProjectGraph is available.

[2022-09-02T13:34:53.235Z]

[2022-09-02T13:34:53.235Z] If you are leveraging `readCachedProjectGraph()` directly then you will need to refactor your usage to first ensure that

[2022-09-02T13:34:53.235Z] the ProjectGraph is created by calling `await createProjectGraphAsync()` somewhere before attempting to read the data.

[2022-09-02T13:34:53.235Z]

[2022-09-02T13:34:53.235Z] If you encounter this error as part of running standard `nx` commands then please open an issue on https://github.com/nrwl/nx

[2022-09-02T13:34:53.235Z] at readCachedProjectGraph (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/src/project-graph/project-graph.js:29:15)

[2022-09-02T13:34:53.235Z] at run (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/src/command-line/run.js:168:69)

[2022-09-02T13:34:53.235Z] at requireCli (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/bin/run-executor.js:20:23)

[2022-09-02T13:34:53.235Z] at Object.<anonymous> (/home/ubuntu/jenkins-slave/caches/frontend/node_modules/nx/bin/run-executor.js:14:1)

[2022-09-02T13:34:53.235Z] at Module._compile (node:internal/modules/cjs/loader:1105:14)

[2022-09-02T13:34:53.235Z] at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)

[2022-09-02T13:34:53.235Z] at Module.load (node:internal/modules/cjs/loader:981:32)

[2022-09-02T13:34:53.235Z] at Function.Module._load (node:internal/modules/cjs/loader:822:12)

[2022-09-02T13:34:53.235Z] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

[2022-09-02T13:34:53.235Z] at node:internal/main/run_main_module:17:47`

Read more comments on GitHub >

github_iconTop Results From Across the Web

NX build: Error - No cached ProjectGraph is available
While trying to run my application built in angular 13 throwing below error. Don't know the reason for this. Any help would be...
Read more >
Project Graph Plugins - Nx
The Project Graph is the representation of the source code in your repo. ... However, there is a cache that Nx uses to...
Read more >
What is new in Nx 13.10?
As a result, whenever Nx runs an operation that requires the project graph, it is already there and ready to be used, without...
Read more >
Issues · nrwl/nx · GitHub
Getting error: NX Cannot read properties of undefined (reading 'data') ... Apple Silicon (ARM) No native build was found for platform=linux ...
Read more >
Optimizing Next.js Applications With Nx - Smashing Magazine
Caching Nx also stores the cached project graph. ... With this setup, one GitHub repository can house the code source for various ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found