sentry-wizard
sentry-wizard copied to clipboard
Sentry wizard fails to install when yarn is not available on host
Environment
Wizard Version: 3.22.3 Don't have yarn installed
Steps to Reproduce
- run npx @sentry/wizard@latest -i sourcemaps
Expected Result
Installation would be successful
Actual Result
◇ Installation failed.
│
■ Encountered the following error during installation:
│
│ Error: Command failed: yarn add @sentry/cli
│ /bin/sh: yarn: command not found
│
Hey @luisitoguanes thanks for writing in! Can you share a little bit more context? Which kind of project did you call the source maps wizard in? And just to confirm, would you have expected that npm was called instead of yarn?
Generally, we try to auto detect the package manager by checking for the respective lock files in the project. In case we can't auto-detect lock files, we fall back to npm as the default package manager. I'm not sure why in your case it selected yarn but we'll find it out :)
hi @Lms24. Sure, I'm working on a react cra app, using always npm, didn't even have yarn installed.
But, now that you mention this, I do have a yarn.lock file as well (weirdly being updated somehow when I install something using npm 🤷♂️) sorry for creating an issue for that 😅
Ahh that makes sense indeed 😅
No worries! I'll leave this issue open because we should probably give you a way to override the package manager selection. I'm currently thinking of a CLI argument to accomplish this. Will backlog for now though.
Just to confirm: are you blocked by this or can you work around the issue for now?
I just installed @sentry/cli with npm manually and then run the wizard again. I didn't have any other issue. Sorry that I didn't put all this on the issue to begin with
No worries! Just glad you got it working :)
I used the wizard and experienced the same problem. The automatic detection of the package manager should be parameterized or check if a yarn.lock AND a package.json is present.
To fix that, I renamed the yarn.lock temporary (yarn.lock.bak).
Hey @SteamWind
The automatic detection of the package manager should be parameterized
You mean as in, we should offer something like a --pacman argument to pass in a specific package manager?
check if a yarn.lock AND a package.json is present
Would you mind explaining how you ran into this situation? I'm wondering how could there be a yarn lock without a package.json.
@Lms24 I think this is more about the situation where a yarn.lock and a package-lock.json or equivalent are present.
I don't think we should add a package manager command line argument. Nobody will ever see it.
My first thought was that we should ask for the package manager when we first try to install and fail.
@Lms24 Thanks for the fix! Unfortunately I can't test it because I worked around it.