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

Corepack packageManager set to pnpm triggers warning with assets:precompile #494

Open
2 tasks done
jprosevear opened this issue Sep 7, 2024 · 0 comments
Open
2 tasks done
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified

Comments

@jprosevear
Copy link

  • I have tried upgrading by running bundle update vite_ruby.
  • I have read the troubleshooting section before opening an issue.

Description 📖

With corepack enabled and packageManager set (to pnpm in my case), running rake assets:precompile will throw a warning (but continue):

/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22373
              throw new UsageError(`This project is configured to use ${result.spec.name} because ${result.target} has a "packageManager" field`);
                    ^

UsageError: This project is configured to use pnpm because /Users/jpr/src/Rhino/mono-test/rhino-project-template_rails_mono/package.json has a "packageManager" field
    at Engine.findProjectSpec (/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22373:21)
    at async Engine.executePackageManagerRequest (/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22404:24)
    at async Object.runMain (/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:23096:5) {
  clipanion: { type: 'usage' }
}

I have traced this to:

if ViteRuby.commands.legacy_yarn_version?

Because it runs the yarn command (when it is not installed), triggering the warning. I suspect that yarn call should either:

  • Check for the 'yarn' binary before running the command OR
  • Only run this if yarn is the package manager

Reproduction 🐞

Vite Ruby Info

Run bin/rake vite:info and provide the output:

bin/vite present?: true
vite_ruby: 3.8.2
vite_rails: 3.0.17
rails: 7.1.3.4
ruby: ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin23]
node: v20.14.0
pnpm: 9.9.0

Logs 📜

Screenshots 📷

image image
@jprosevear jprosevear added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified
Projects
None yet
Development

No branches or pull requests

1 participant