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

Failed to parse bun lockfile #26565

Closed
1 of 4 tasks
jimlloyd opened this issue Jun 15, 2024 · 2 comments
Closed
1 of 4 tasks

Failed to parse bun lockfile #26565

jimlloyd opened this issue Jun 15, 2024 · 2 comments

Comments

@jimlloyd
Copy link

jimlloyd commented Jun 15, 2024

Current Behavior

The following error occurs for a variety of bun nx ... commands. For example:

bun nx run @memento-ai/memento-agent:lint

Note that I am in the process of migrating an existing bun monorepo project to use nx. After a few false starts I was able to get to the point where I could run lint on each package. I had not been running eslint previously so I found and fixed many warnings and errors, and in particular found and fixed multiple instances of cyclic dependencies (which made me very happy).

But oddly, I got to the point where all packages passed lint (i.e. bun nx run-many --target=lint --all=true --with-deps=true was successful), and then committed about a dozen different files that had been modified with my last set of changes, and that somehow caused this problem.

 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: Expected double-quoted property name in JSON at position 219 (line 11 column 3)


SyntaxError: Expected double-quoted property name in JSON at position 219 (line 11 column 3)
    at JSON.parse (<anonymous>)
    at getHoistedPackageVersion (/Users/jim.lloyd/hub/Memento/node_modules/nx/src/plugins/js/lock-file/utils/package-json.js:13:21)
    at getHoistedVersion (/Users/jim.lloyd/hub/Memento/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:191:65)
    at findHoistedNode (/Users/jim.lloyd/hub/Memento/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:120:28)
    at getNodes (/Users/jim.lloyd/hub/Memento/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:109:29)
    at getYarnLockfileNodes (/Users/jim.lloyd/hub/Memento/node_modules/nx/src/plugins/js/lock-file/yarn-parser.js:30:12)
    at getLockFileNodes (/Users/jim.lloyd/hub/Memento/node_modules/nx/src/plugins/js/lock-file/lock-file.js:51:59)
    at exports.createNodes (/Users/jim.lloyd/hub/Memento/node_modules/nx/src/plugins/js/index.js:47:64)
    at /Users/jim.lloyd/hub/Memento/node_modules/nx/src/project-graph/plugins/utils.js:47:33
    at Array.map (<anonymous>)

Expected Behavior

No error.

GitHub Repo

https://github.com/memento-ai/Memento

Steps to Reproduce

  1. Clone the repo
  2. git checkout nx-try-3
  3. bun install
  4. bun nx run @memento-ai/memento-agent:lint

I also tried to rollback to prior commits where nx lint was working, but I had been working with multiple modified files. The problem only occurred after committing all files. I did this with a series of commits, but did not run nx lint again during the process of committing, and was unable to figure out if there was a particular commit that caused the breakage.

My efforts to rollback and fix were done in the branch temp-1a2e107. The commit 1a2e107 is in the history of nx-try-3.

Nx Report

NX   Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.

Failure Logs

No response

Package Manager Version

bun: 1.1.12 or 1.1.13

Operating System

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

Additional Information

Probably related to #26053

@jimlloyd
Copy link
Author

I was able to diagnose and fix the primary problem. My method was to simply try to use yarn to install and the discover that it reported errors that clearly should be fixed. After fixing all of those errors, bun nx ... commands are working.

@Jordan-Hall no need to follow up. Thanks for doing this integration, it would be painful to have to give up bun.

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 Jul 25, 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

1 participant