nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.59k stars 2.36k forks source link

Consistent "Failed to process project graph" #27285

Open jd-carroll opened 3 months ago

jd-carroll commented 3 months ago

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:esbuild@0.23.0
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:esbuild@0.23.0
        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

Additional Information

No response

jd-carroll commented 3 months ago

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 commented 3 months ago

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