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

v19.1.0 nx fails if bun.lockb is present #26053

Closed
1 of 4 tasks
gabynevada opened this issue May 25, 2024 · 28 comments
Closed
1 of 4 tasks

v19.1.0 nx fails if bun.lockb is present #26053

gabynevada opened this issue May 25, 2024 · 28 comments

Comments

@gabynevada
Copy link

Current Behavior

If I keep or add bun.lockb to the project all nx commands fails. If no bun.lockb projects runs fine, if bun.lockb is present then it errors.

Expected Behavior

Project runs like it does without bun.lockb

GitHub Repo

No response

Steps to Reproduce

  1. On a functioning angular Nx monorepo run bun i
  2. Try serving, building, formatting a project.

Example commands that are failing:

  • nx run my-project:serve
  • nx format
  • nx report

Nx Report

Node   : 20.10.0
OS     : darwin-arm64
npm    : 10.2.3

nx (global)        : 19.1.0
nx                 : 19.1.0
@nx/js             : 19.1.0
@nx/jest           : 19.1.0
@nx/linter         : 19.1.0
@nx/eslint         : 19.1.0
@nx/workspace      : 19.1.0
@nx/angular        : 19.1.0
@nx/devkit         : 19.1.0
@nx/eslint-plugin  : 19.1.0
@nx/playwright     : 19.1.0
@nrwl/tao          : 19.1.0
@nx/vite           : 19.1.0
@nx/web            : 19.1.0
@nx/webpack        : 19.1.0
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@briebug/jest-schematic : 6.0.0
@cypress/schematic      : 2.5.1

Failure Logs

*  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'
}

Package Manager Version

npm version 10.2.3 and bun version 1.1.10

Operating System

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

Additional Information

No response

@Jordan-Hall
Copy link
Contributor

Jordan-Hall commented May 25, 2024

Have you got a public repo i can check it out. I maybe link to a previous issue

FrozenPandaz pushed a commit that referenced this issue May 27, 2024
This fix add support for bun PM in daemon and affected changes.

Helps towards #26053 fix
@flipcasa
Copy link

flipcasa commented May 27, 2024

@Jordan-Hall

getting the following error
argument 'value' must be either string of Buffer
points to @nx/webpack/src/plugins/generate-package-json-plugin.js:39:82

this happens with nestjs project with generatePackageJson true

i tested with [19.2.0-beta.0]

@Jordan-Hall
Copy link
Contributor

@Jordan-Hall

getting the following error argument 'value' must be either string of Buffer points to @nx/webpack/src/plugins/generate-package-json-plugin.js:39:82

this happens with nestjs project with generatePackageJson true

i tested with [19.2.0-beta.0]

Have you got a repro I can check feels strange all testing around that code and not seen that issue :( even outside and ove been using this as a patch since last year

FrozenPandaz pushed a commit that referenced this issue May 28, 2024
This fix add support for bun PM in daemon and affected changes.

Helps towards #26053 fix

(cherry picked from commit 4cbb0f0)
@flipcasa
Copy link

@Jordan-Hall
getting the following error argument 'value' must be either string of Buffer points to @nx/webpack/src/plugins/generate-package-json-plugin.js:39:82
this happens with nestjs project with generatePackageJson true
i tested with [19.2.0-beta.0]

Have you got a repro I can check feels strange all testing around that code and not seen that issue :( even outside and ove been using this as a patch since last year

sorry for the delay @Jordan-Hall
this is the repo https://github.com/flipcasa/nxbun

@mikeallisonJS
Copy link

having this same or similar issue here:
https://github.com/JesusFilm/core/tree/24-03-MA-feat-bun-package-manager

works fine in my personal repo, but not this one

no error on 19.1, on 19.2-beta2 I get:

Please open an issue at `https://github.com/nrwl/nx/issues/new?template=1-bug.yml` and provide a reproduction.

Original error: Target project does not exist: npm:string-width@npm:string-width@^4.2.0


Error: Target project does not exist: npm:string-width@npm:string-width@^4.2.0
    at validateCommonDependencyRules (/workspaces/core/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
    at validateDependency (/workspaces/core/node_modules/nx/src/project-graph/project-graph-builder.js:313:5)
    at /workspaces/core/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:214:80
    at Array.forEach (<anonymous>)
    at /workspaces/core/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:205:49
    at Array.forEach (<anonymous>)
    at /workspaces/core/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:203:72
    at Array.forEach (<anonymous>)
    at /workspaces/core/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:200:26
    at Array.forEach (<anonymous>)

@Jordan-Hall
Copy link
Contributor

@jaysoo I believe this maybe a issue with bun.

project-graph/project-graph-builder.js:323:15

Im sorry i've taken a look and i'm unsure about this.

When using yarn i get the following error:
Error: Both project and target have to be specified
at parseRunOneOptions (/home/jordan/dev/core/node_modules/nx/src/command-line/run/run-one.js:102:15)
at Object.runOne (/home/jordan/dev/core/node_modules/nx/src/command-line/run/run-one.js:25:18)
at async handleErrors (/home/jordan/dev/core/node_modules/nx/src/utils/params.js:9:16)
at async Object.handler (/home/jordan/dev/core/node_modules/nx/src/command-line/run/command-object.js:28:9)
Done in 0.59s.

bun on right yarn on the left https://www.diffchecker.com/o6qeyfg7/ If i run bun install string-width@^4.2.0 it goes to the next one.

Sorry i cant be more help here

@cskiwi
Copy link

cskiwi commented Jun 1, 2024

Hi,

As mentioned in the PR now having a different error when updating to beta-5
Might be something in the project itself, i'm debugging right now

Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
  AggregateCreateNodesError: An error occurred while processing files for the nx/js/dependencies-and-lockfile plugin.
    - bun.lockb: Command failed: bun <redacted>\bun.lockb
  [0.00ms] ".env"
  ============================================================
  Bun v1.1.10 (5102a944) Windows x64
  Args: "bun" "<redacted>\bun.lockb"
  Features: dotenv
  Elapsed: 10ms | User: 0ms | Sys: 0ms
  RSS: 26.65MB | Peak: 26.65MB | Commit: 62.65MB | Faults: 6657

  panic(main thread): Internal assertion failure
  oh no: Bun has crashed. This indicates a bug in Bun, not your code.

  To send a redacted crash report to Bun's team,
  please file a GitHub issue using the link below:

   https://bun.report/1.1.10/wa15102a94AgIgyo6L+o9vI6kr4F+hwC2nkxFogoxFmvtyFqn4BiiJo3ht+CA0eNrzzCtJLcpLzFFILC5OLSrJzM9TSEvMzCktSgUAiSkKPg


      at createNodesFromFiles (<redacted>\node_modules\nx\src\project-graph\plugins\utils.js:58:15)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async LoadedNxPlugin.createNodes.<computed> (<redacted>\node_modules\nx\src\project-graph\plugins\internal-api.js:41:28)
      at async Promise.all (index 5)
      at async processFilesAndCreateAndSerializeProjectGraph (<redacted>\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:148:43)      
      at async getCachedSerializedProjectGraphPromise (<redacted>\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:46:16)
      at async handleRequestProjectGraph (<redacted>\node_modules\nx\src\daemon\server\handle-request-project-graph.js:12:24)
      at async handleResult (<redacted>\node_modules\nx\src\daemon\server\server.js:107:16)
      at async handleMessage (<redacted>\node_modules\nx\src\daemon\server\server.js:78:9)
      at async <redacted>\node_modules\nx\src\daemon\server\server.js:45:9

@Jordan-Hall
Copy link
Contributor

Yea that's a different issue to one fixed in PR. This related to this issue im struggling tk debug because it's the yarn parser I believe

@cskiwi
Copy link

cskiwi commented Jun 1, 2024

So from what I can see it's just the problem of running bun bun.lockb that is still causing this. running it on a smaller poject in the command line returns the dependencies, while in the big project this crashes

@Jordan-Hall
Copy link
Contributor

Jordan-Hall commented Jun 1, 2024

Agree why I'm unsure. They a set error message if it was buffer. The one I debug it looms like lock file maybe wrong installing package directly in package.json it worked fine.

Bun lock contains 6000 more likes than standard yarn lock

@flipcasa
Copy link

flipcasa commented Jun 1, 2024

@Jordan-Hall

getting the following error argument 'value' must be either string of Buffer points to @nx/webpack/src/plugins/generate-package-json-plugin.js:39:82

this happens with nestjs project with generatePackageJson true

i tested with [19.2.0-beta.0]

Have you got a repro I can check feels strange all testing around that code and not seen that issue :( even outside and ove been using this as a patch since last year

sorry for the delay @Jordan-Hall

this is the repo https://github.com/flipcasa/nxbun

@Jordan-Hall did you get a chance to try out this repo

@Jordan-Hall
Copy link
Contributor

Yes 1 I was debugging. Looks like yarn and bun producing completely different lock. I installed the package it complained about and it worked fine :/

@cskiwi
Copy link

cskiwi commented Jun 1, 2024

Hmm found something interesting now, If i run bun install -y to create a yarn compatible file found on: https://bun.sh/docs/install/lockfile

This also crashes, so might be time to move this to the bun github as it looks like this is something on their side

@Jordan-Hall
Copy link
Contributor

Hmm found something interesting now, If i run bun install -y to create a yarn compatible file found on: https://bun.sh/docs/install/lockfile

This also crashes, so might be time to move this to the bun github as it looks like this is something on their side

It doesn't respect the yarn lock. But it could well be with bun because yarn not producing same file. Bun.locb is a self execution of that bun install -y

@Jordan-Hall
Copy link
Contributor

@Jordan-Hall
getting the following error argument 'value' must be either string of Buffer points to @nx/webpack/src/plugins/generate-package-json-plugin.js:39:82
this happens with nestjs project with generatePackageJson true
i tested with [19.2.0-beta.0]

Have you got a repro I can check feels strange all testing around that code and not seen that issue :( even outside and ove been using this as a patch since last year

sorry for the delay @Jordan-Hall this is the repo https://github.com/flipcasa/nxbun

Using yarn on that repo failed for me too.

@flipcasa
Copy link

flipcasa commented Jun 1, 2024

@Jordan-Hall

getting the following error argument 'value' must be either string of Buffer points to @nx/webpack/src/plugins/generate-package-json-plugin.js:39:82

this happens with nestjs project with generatePackageJson true

i tested with [19.2.0-beta.0]

Have you got a repro I can check feels strange all testing around that code and not seen that issue :( even outside and ove been using this as a patch since last year

sorry for the delay @Jordan-Hall this is the repo https://github.com/flipcasa/nxbun

Using yarn on that repo failed for me too.

its weird it keeps failing for only nestjs projects
it's working fine on node/js projects

@cskiwi
Copy link

cskiwi commented Jun 1, 2024

Here also nestjs,

Also the same package.json worked on my WSL environment (I created a new project only with the package.json). Don't know if you are also using windows?

@flipcasa
Copy link

flipcasa commented Jun 1, 2024

Here also nestjs,

Also the same package.json worked on my WSL environment (I created a new project only with the package.json). Don't know if you are also using windows?

im using mac

@cskiwi
Copy link

cskiwi commented Jun 1, 2024

its weird it keeps failing for only nestjs projects it's working fine on node/js projects

I was testing if this was really true. So I made a package.json with no nest and still lots of other deps and the issue was still there.
Interesting that on my pc this always "crashed" on the listing of dependencies after @angular-devkit/build-angular.


"@angular-devkit/build-angular@>= 15.0.0 < 18.0.0", "@angular-devkit/build-angular@>=15.0.0 <19.0.0", "@angular-devkit/build-angular@~17.3.7":      
  version "17.3.8"
  resolved "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-17.3.8.tgz"
  integrity sha512-ixsdXggWaFRP7Jvxd0AMukImnePuGflT9Yy7NJ9/y0cL/k//S/3RnkQv5i411KzN+7D4RIbNkRGGTYeqH24zlg==
  dependencies:
    ora "5.4.1"
    less "4.2.0"
    open "8.4.2"
    rxjs "7.8.1"
    sass "1.71.1"
    vite "5.1.7"
    tslib "2.6.2"
    mrmime "2.0.0"
    semver "7.6.0"
    terser "5.29.1"
    undici "6.11.1"
  optionalDependencies:
    esbuild "0.20.1"
  dependencies:
============================================================
Bun v1.1.12 (43f0913c) Win

Pushing it to the output bun bun.lockb &> output.log this is already crashing on line 70. which is amazinly fast I think

Edit; looking at the output this is shoiwng 2x dependencies for that package. might be something to look in to, or this is probably just weird console output

@cskiwi
Copy link

cskiwi commented Jun 9, 2024

So,

For anyone wondering. This was fixed in version 1.1.12 of bun. I still had to use the canary version to get it working on my win 11 machine. But seems to be something on my side.

Thanks to the bun team for fixing this issue !

@Jordan-Hall
Copy link
Contributor

Thank you @cskiwi for sending this to bun. I had a feeling it was there side but wasn't too sure. @jaysoo Believe this is the last issue of bun and its closed

@jimlloyd
Copy link

jimlloyd commented Jun 15, 2024

I am using bun 1.1.12 and seeing a similar problem. See the issue I just filed: #26565 .

@Jordan-Hall is there any workaround for this problem other than abandoning bun?

edit: 1.1.13 is out. It does not fix the problem.

@Jordan-Hall
Copy link
Contributor

Not sure atm I'll check your repo put when I get a minute (end of Monday st latest)

Sorry for the issues :(

@nodegin
Copy link
Contributor

nodegin commented Jul 21, 2024

Getting the same error "Failed to parse bun lockfile"

Steps to reproduce:

  1. Prepare a node project with package-lock.json
  2. Run bun i, Bun should logs migrated lockfile from package-lock.json
  3. Run nx build

@jaysoo
Copy link
Member

jaysoo commented Aug 21, 2024

I'm going to close this issue as the original problem with bun.lockb seems to be fixed.

@nodegin It looks like the migrated lockfile that is migrated from package-lock.json is failing. Can you file a new issue to track this?

@jaysoo jaysoo closed this as completed Aug 21, 2024
@BleedingDev
Copy link

Today I've run into this issue when trying to build docker image. Here is my Github Action output:
NaucMeIT/web/actions/runs/10587556981/job/29338499413

Is there something more you need, @jaysoo? Current code is in the repository, I keep fighting with Prisma + Nx + Bun combo and this just another issue that popped up after I moved forward with Prisma issue. :(

@FaisalAfroz
Copy link

I am getting this error too. The failing part from my logs

[NX Daemon Server] - 2024-08-28T03:06:31.492Z - [REQUEST]: Responding to the client. handleNxWorkspaceFiles
[NX Daemon Server] - 2024-08-28T03:06:31.492Z - Done responding to the client handleNxWorkspaceFiles
[NX Daemon Server] - 2024-08-28T03:06:31.492Z - Handled GET_FILES_IN_DIRECTORY. Handling time: 1. Response time: 0.
[NX Daemon Server] - 2024-08-28T03:06:31.756Z - Time taken for 'build-project-configs' 717.620939ms

NX Failed to parse bun lockfile

Please open an issue at https://github.com/nrwl/nx/issues/new?template=1-bug.yml and provide a reproduction.

Original error: Target project does not exist: npm:string-width@npm:string-width@^4.2.0

Error: Target project does not exist: npm:string-width@npm:string-width@^4.2.0

Copy link

github-actions bot commented Oct 1, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests