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

When using Bun and building in containers, respect the yarn.lock file #25978

Closed
1 of 4 tasks
benpsnyder opened this issue May 23, 2024 · 5 comments · Fixed by #25985
Closed
1 of 4 tasks

When using Bun and building in containers, respect the yarn.lock file #25978

benpsnyder opened this issue May 23, 2024 · 5 comments · Fixed by #25985

Comments

@benpsnyder
Copy link
Contributor

benpsnyder commented May 23, 2024

Current Behavior

Within your Dockerfile, use bun install -y which should generate a yarn.lock
See the errors faster if you use ENV NX_DAEMON=false; if ENV NX_DAEMON=true then you will need to do something like this to see your errors

# Run the build command and print the log if it fails
RUN NX_DAEMON=true nx run-many --all --target=build --configuration=production --verbose || \
    (echo "Build failed. Outputting log:" && cat /app/.nx/cache/d/daemon.log && exit 1)

use bun nx run ... and not bun --bun nx run ...

Expected Behavior

I expect builds to go forward using the yarn.lock without throwing this kind of message

0.377 $ nx run meritos-edge-gui-portal:build --configuration=production
2.259 The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
5.153 node:internal/process/promises:289
5.153             triggerUncaughtException(err, true /* fromPromise */);
5.153             ^
5.153 
5.153 [Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
5.153   The "nx/js/dependencies-and-lockfile" plugin threw an error while creating nodes from bun.lockb:
5.153     Error: spawnSync /bin/sh ENOBUFS
5.153         at Object.spawnSync (node:internal/child_process:1124:20)
5.153         at spawnSync (node:child_process:875:24)
5.153         at execSync (node:child_process:956:15)
5.153         at exports.createNodes (/app/node_modules/nx/src/plugins/js/index.js:36:44)
5.153         at /app/node_modules/nx/src/project-graph/plugins/utils.js:49:54
5.153         at Array.map (<anonymous>)
5.153         at runCreateNodesInParallel (/app/node_modules/nx/src/project-graph/plugins/utils.js:47:34)
5.153         at LoadedNxPlugin.createNodes (/app/node_modules/nx/src/project-graph/plugins/internal-api.js:23:74)
5.153         at createProjectConfigurations (/app/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:253:17)
5.153         at retrieveProjectConfigurations (/app/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:42:74)] {
5.153   name: 'ProjectGraphError'
5.153 }
5.153 
5.153 Node.js v22.1.0
5.205 error: script "nx" exited with code 1

GitHub Repo

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

Steps to Reproduce

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

Nx Report

Node   : 22.1.0
OS     : linux-x64
bun    : 1.1.9

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-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

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

Additional Information

No response

@benpsnyder
Copy link
Contributor Author

@Jordan-Hall kindly track this issue. I will work on getting a repo public to reproduce the issues so we can all debug more easily. Cc: @jaysoo

@Jordan-Hall
Copy link
Contributor

Jordan-Hall commented May 23, 2024

@benpsnyder its not so much it needs to respect the yarn file here but they an issue with this line

: execSync(`bun ${lockFilePath}`).toString();

It's hitting the max buffer limit. Let me look into a solution for this

@Jordan-Hall
Copy link
Contributor

@benpsnyder Could you do me a favour and check out the PR locally and try using the new solution please. I've not currently got a bigger enough project to test this on

@benpsnyder
Copy link
Contributor Author

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

I will add a Dockerfile build system within 30-60 minutes

Copy link

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 Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants