sentry-wizard icon indicating copy to clipboard operation
sentry-wizard copied to clipboard

Sentry wizard fails to install when yarn is not available on host

Open luisitoguanes opened this issue 1 year ago • 9 comments

Environment

Wizard Version: 3.22.3 Don't have yarn installed

Steps to Reproduce

  1. 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 │

luisitoguanes avatar May 31 '24 19:05 luisitoguanes

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

Lms24 avatar Jun 04 '24 12:06 Lms24

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 😅

luisitoguanes avatar Jun 05 '24 14:06 luisitoguanes

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.

Lms24 avatar Jun 05 '24 19:06 Lms24

Just to confirm: are you blocked by this or can you work around the issue for now?

Lms24 avatar Jun 05 '24 19:06 Lms24

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

luisitoguanes avatar Jun 06 '24 05:06 luisitoguanes

No worries! Just glad you got it working :)

Lms24 avatar Jun 06 '24 17:06 Lms24

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

SteamWind avatar Oct 21 '24 12:10 SteamWind

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 avatar Oct 23 '24 07:10 Lms24

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

lforst avatar Oct 23 '24 07:10 lforst

@Lms24 Thanks for the fix! Unfortunately I can't test it because I worked around it.

SteamWind avatar Apr 08 '25 12:04 SteamWind