-
Notifications
You must be signed in to change notification settings - Fork 31k
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
npm.packageManager=auto incorrectly assumes yarn as package manager for running tasks #170101
Comments
I have the same issue using npm workspaces, and opening vscode not from the root of the monorepo. running debug task from package.json try to use yarn. npm.packageManager=npm solve the issue Vscode 1.74.3 |
Blame to vscode/extensions/npm/src/preferred-pm.ts Lines 46 to 48 in 784bbda
The However, this field also exists in pnpm and npm projects. As a result, this means that all pnpm projects will be detected as yarn projects. Also related to #139654 |
I just ran into this. I expect it is the same issue as #159465. The workaround I used was changing
to
|
Yeah this is pretty insane behavior. It would be very sensible to instead detect the package manager using the project's package.json "packageManager" key if present. |
Reproducing the same behavior. |
Not sure if this recommendation is still current given the churn around corepack. It seems maybe the package manager key was migrated to |
Type: Bug
I have a fairly standard PNPM project, for which I have configured a few VSCode tasks:
When VSCode is set with
npm.packageManager=auto
, it incorrectly assumes that tasks should be run usingyarn
.Since the project uses corepack and specifies a packageManager in
package.json
, using yarn results in an error:This for me doesn't make much sense, because:
package.json
, configured with"packageManager": "pnpm@7.9.3"
(using corepack)pnpm-lock.yaml
and apnpm-workspace.yaml
files, which should correctly hint to the right package manageryarn.lock
or any other yarn-specific files or configurations.If the auto detection for PNPM failed, I'd expect to at least fallback to NPM.
Using
npm.packageManager=pnpm
of course works fine.VS Code version: Code - Insiders 1.75.0-insider (6ed4d43, 2022-12-23T05:21:57.802Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: Yes
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (5)
A/B Experiments
The text was updated successfully, but these errors were encountered: