nrwl / nx

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

When using Bun and building within Dockerfile - 'Failed to process project graph. Run "nx reset" to fix this.' re: 'nx/js/dependencies-and-lockfile' #25965

Closed benpsnyder closed 3 months ago

benpsnyder commented 3 months ago

Current Behavior

My buildbase image has already copied the whole repo (./) and lines 6, 7, and 8 in this screenshot are just copying any changed files. I added lines 10, 11 and 12 for my testing process.

image

Expected Behavior

I expected to be able to build all my apps.

GitHub Repo

https://github.com/benpsnyder/nx-bun-testing

Steps to Reproduce

Use a Dockerfile (perhaps with a docker-compose.yaml) to copy in a repo using bun as the package manager. Note I am not using a yarn lock file.

Nx Report

nx (global)        : 19.0.4
nx                 : 19.1.0-beta.2
@nx/js             : 19.1.0-beta.2
@nx/jest           : 19.1.0-beta.2
@nx/linter         : 19.1.0-beta.2
@nx/eslint         : 19.1.0-beta.2
@nx/workspace      : 19.1.0-beta.2
@nx/angular        : 19.1.0-beta.2
@nx/cypress        : 19.1.0-beta.2
@nx/devkit         : 19.1.0-beta.2
@nx/esbuild        : 19.1.0-beta.2
@nx/eslint-plugin  : 19.1.0-beta.2
@nx/nest           : 19.1.0-beta.2
@nx/next           : 19.1.0-beta.2
@nx/node           : 19.1.0-beta.2
@nx/plugin         : 19.1.0-beta.2
@nx/react          : 19.1.0-beta.2
@nrwl/tao          : 19.1.0-beta.2
@nx/vite           : 19.1.0-beta.2
@nx/web            : 19.1.0-beta.2
@nx/webpack        : 19.1.0-beta.2
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx-dotnet/core
@nx/vite/plugin
@nxlv/python
---------------------------------------
Community plugins:
@analogjs/content             : 1.3.1
@analogjs/platform            : 1.3.1
@analogjs/router              : 1.3.1
@analogjs/trpc                : 0.2.45
@analogjs/vite-plugin-angular : 1.3.1
@compodoc/compodoc            : 1.1.24
@jscutlery/semver             : 5.2.2
@monodon/rust                 : 1.4.0
@ngrx/component-store         : 17.2.0
@ngrx/schematics              : 17.2.0
@ngrx/store                   : 17.2.0
@ngxpert/cmdk                 : 2.0.0
@nx-bun/nx                    : 1.2.0
@nx-dotnet/core               : 2.2.0
@nx-tools/nx-container        : 6.0.1
@nx/rspack                    : 19.0.0
@nxlv/python                  : 18.1.0
@storybook/angular            : 8.1.3
@syccure/authorization        : 0.1.0
eslint-plugin-ngrx            : 2.1.4
ngx-toastr                    : 18.0.0

Failure Logs

No response

Package Manager Version

bun 1.1.9

Operating System

Additional Information

No response

benpsnyder commented 3 months ago

Here is the output with NX_DAEMON=true; line 11 is a workaround so line 12 I can output the log to console image

benpsnyder commented 3 months ago

Success with bun --bun nx; please note bun nx did not work image

@jaysoo / @Jordan-Hall you may be interested in this ^

Jordan-Hall commented 3 months ago

Success with bun --bun nx; please note bun nx did not work image

@jaysoo / @Jordan-Hall you may be interested in this ^

So forcing nx to run in complete bun working fine hmm I wonder if its soemthing missing inside bun then. I'll have to try and debug it soon

benpsnyder commented 3 months ago

Opened https://github.com/nrwl/nx/issues/25978 to track building with bun nx run .... (not bun --bun) while also installing with bun install -y to produce a yarn.lock file

Jordan-Hall commented 3 months ago

Opened #25978 to track building with bun nx run .... (not bun --bun) while also installing with bun install -y to produce a yarn.lock file

We dont need to use yarn.lock here. The reason for failing is the same. bun has a better max buffer by default. I think the solution will work for it

benpsnyder commented 3 months ago

I am building out a testing repo here: https://github.com/benpsnyder/nx-bun-testing

gabynevada commented 3 months ago

Is this related to this problem or should it be a separate issue? If no bun.lockb projects runs fine, if bun.lockb is present then it errors:

 *  Executing task: bun nx run my-project:serve 

$ nx run my-project:serve
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[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:http-proxy-middleware
        at validateCommonDependencyRules (/Projects/my-project/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
        at validateDependency (/Projects/my-project/node_modules/nx/src/project-graph/project-graph-builder.js:313:5)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:214:80
        at Array.forEach (<anonymous>)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:205:49
        at Array.forEach (<anonymous>)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:203:72
        at Array.forEach (<anonymous>)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:200:26
        at Array.forEach (<anonymous>)] {
  name: 'ProjectGraphError'
}
Jordan-Hall commented 3 months ago

Is this related to this problem or should it be a separate issue? If no bun.lockb projects runs fine, if bun.lockb is present then it errors:

 *  Executing task: bun nx run my-project:serve 

$ nx run my-project:serve
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[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:http-proxy-middleware
        at validateCommonDependencyRules (/Projects/my-project/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
        at validateDependency (/Projects/my-project/node_modules/nx/src/project-graph/project-graph-builder.js:313:5)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:214:80
        at Array.forEach (<anonymous>)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:205:49
        at Array.forEach (<anonymous>)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:203:72
        at Array.forEach (<anonymous>)
        at /Projects/my-project/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:200:26
        at Array.forEach (<anonymous>)] {
  name: 'ProjectGraphError'
}

This is different, this looks like not everything is copied into the docker. npm:http-proxy-middleware. This is missing

Error: Target project does not exist: npm:http-proxy-middleware

Jordan-Hall commented 3 months ago

@benpsnyder can you check with 19.2 beta please to see if this still exists?

benpsnyder commented 3 months ago

Fixed in latest beta release :)

github-actions[bot] commented 1 month ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.