Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent "Failed to process project graph" #27285

Open
1 of 4 tasks
jd-carroll opened this issue Aug 3, 2024 · 3 comments · May be fixed by #29529
Open
1 of 4 tasks

Consistent "Failed to process project graph" #27285

jd-carroll opened this issue Aug 3, 2024 · 3 comments · May be fixed by #29529

Comments

@jd-carroll
Copy link

jd-carroll commented Aug 3, 2024

Current Behavior

MBP % lerna run build
info cli using local version of lerna
lerna notice cli v8.1.7
lerna ERR! Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
lerna ERR!   The "nx/js/dependencies-and-lockfile" plugin threw an error while creating dependencies:
lerna ERR!     Error: Target project does not exist: npm:[email protected]
lerna ERR!         at validateCommonDependencyRules (/develop/project/user-accounts-workbench/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
lerna ERR!         at validateDependency (/develop/project/user-accounts-workbench/node_modules/nx/src/project-graph/project-graph-builder.js:314:5)
lerna ERR!         at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:214:80
lerna ERR!         at Array.forEach (<anonymous>)
lerna ERR!         at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:205:49
lerna ERR!         at Array.forEach (<anonymous>)
lerna ERR!         at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:203:72
lerna ERR!         at Array.forEach (<anonymous>)
lerna ERR!         at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:200:26
lerna ERR! lerna Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.

Expected Behavior

lerna run to work

GitHub Repo

No response

Steps to Reproduce

  1. lerna run (probably with esbuild involved)

Nx Report

LOL, `nx report` fails because it cannot construct the project graph...

MBP % npx nx report

 NX   Report complete - copy this into the issue template

Node           : 20.12.2
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 4.3.1

nx          : 19.5.6
lerna       : 8.1.7
@nx/devkit  : 19.5.6
@nrwl/tao   : 19.5.6
typescript  : 5.5.4
---------------------------------------
⚠️ Unable to construct project graph.
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
  The "nx/js/dependencies-and-lockfile" plugin threw an error while creating dependencies:
    Error: Target project does not exist: npm:[email protected]
        at validateCommonDependencyRules (/develop/project/user-accounts-workbench/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
        at validateDependency (/develop/project/user-accounts-workbench/node_modules/nx/src/project-graph/project-graph-builder.js:314:5)
        at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:214:80
        at Array.forEach (<anonymous>)
        at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:205:49
        at Array.forEach (<anonymous>)
        at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:203:72
        at Array.forEach (<anonymous>)
        at /develop/project/user-accounts-workbench/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:200:26
        at Array.forEach (<anonymous>)

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@jd-carroll
Copy link
Author

I think it needs to be said that this is a little frustrating. I truly appreciate everyone's effort in pulling this tool together and maintaining it, but this is the second pretty significant regression (failure?) I've encountered this year.

And the most frustrating part of all of this is that I don't even want to use Nx. I would like to use Lerna.

In all seriousness, I think you should do one of the following:

  1. Delete / Deprecate / Archive the Lerna project to make it clear that it doesn't exist any more.
  2. Delete all nx dependencies from the Lerna project.

Again, I really do appreciate the investment Nrwl is making in the monorepo tooling space and that at the end of the day Nrwl is a business that needs to make money.

So make it clear, is it Nx or Lerna? And if Lerna is still a thing, then it should be independent of Nx.

@jd-carroll
Copy link
Author

To reproduce in any project, add a dependency to @yarnpkg/builder

The root cause of the issue appears to be in how they define their esbuild dependency:

{
  "name": "@yarnpkg/builder",
  "version": "4.1.1",
  "license": "BSD-2-Clause",
  "bin": "./lib/cli.js",
  "exports": {
    ".": "./lib/index.js",
    "./cli": "./lib/cli.js",
    "./package.json": "./package.json"
  },
  "dependencies": {
    "@yarnpkg/cli": "^4.2.1",
    "@yarnpkg/core": "^4.0.5",
    "@yarnpkg/fslib": "^3.0.2",
    "chalk": "^3.0.0",
    "clipanion": "^4.0.0-rc.2",
    "esbuild": "npm:esbuild-wasm@^0.15.15",
    "semver": "^7.1.2",
    "tslib": "^2.4.0"
  },

Does that make this a @yarnpkg/builder issue: Maybe
Is this still an nx issue: Absolutely

@newsiberian
Copy link

newsiberian commented Jan 5, 2025

Probably related to our issue as well. We are using docusaurus docs and they recently introduced such depencency

"react-helmet-async": "npm:@slorber/react-helmet-async@*",

as a result, we'd started to receive

⚠️ Unable to construct project graph.
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
      The "nx/js/dependencies-and-lockfile" plugin threw an error while creating dependencies: Target project does not exist: npm:react-helmet-async@npm:@slorber/react-helmet-async@*
    Error: Target project does not exist: npm:react-helmet-async@npm:@slorber/react-helmet-async@*
        at validateCommonDependencyRules (/Users/xxx/frontend/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
        at validateDependency (/Users/xxx/frontend/node_modules/nx/src/project-graph/project-graph-builder.js:314:5)
        at /Users/xxx/frontend/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:214:80
        at Array.forEach (<anonymous>)
        at /Users/xxx/frontend/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:205:49
        at Array.forEach (<anonymous>)
        at /Users/xxxfrontend/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:203:72
        at Array.forEach (<anonymous>)
        at /Users/xxx/frontend/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:200:26
        at Array.forEach (<anonymous>)

This happens because this condition https://github.com/nrwl/nx/blob/master/packages/nx/src/project-graph/project-graph-builder.ts#L525 and this https://github.com/nrwl/nx/blob/master/packages/nx/src/project-graph/project-graph-builder.ts#L528 don't take into account such syntax. I'll try to come up w/ the solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants