Skip to content

Support pnpm #421

Not planned
Listed in
Not planned
Listed in
@muuvmuuv

Description

@muuvmuuv

I tried publishing my extension but recently switched to use pnpm instead of npm. vsce seems to not support this package manager (does yarn even works, very similar to pnpm) since it tries to do npm list --production --parseable --depth=99999 which fails in pnpm projects because of the different handling of dependencies.

Project: https://github.com/muuvmuuv/vscode-sundial

Error:

❯ npm list --production --parseable --depth=99999
/Users/marvinheilemann/Development/VSCode/vscode-sundial
/Users/marvinheilemann/Development/VSCode/vscode-sundial/node_modules/dayjs
/Users/marvinheilemann/Development/VSCode/vscode-sundial/node_modules/got
/Users/marvinheilemann/Development/VSCode/vscode-sundial/node_modules/public-ip
/Users/marvinheilemann/Development/VSCode/vscode-sundial/node_modules/suncalc
npm ERR! missing: @sindresorhus/is@^1.0.0, required by got@10.5.5
npm ERR! missing: @szmarczak/http-timer@^4.0.0, required by got@10.5.5
npm ERR! missing: @types/cacheable-request@^6.0.1, required by got@10.5.5
npm ERR! missing: cacheable-lookup@^2.0.0, required by got@10.5.5
npm ERR! missing: cacheable-request@^7.0.1, required by got@10.5.5
npm ERR! missing: decompress-response@^5.0.0, required by got@10.5.5
npm ERR! missing: duplexer3@^0.1.4, required by got@10.5.5
npm ERR! missing: get-stream@^5.0.0, required by got@10.5.5
npm ERR! missing: lowercase-keys@^2.0.0, required by got@10.5.5
npm ERR! missing: mimic-response@^2.0.0, required by got@10.5.5
npm ERR! missing: p-cancelable@^2.0.0, required by got@10.5.5
npm ERR! missing: p-event@^4.0.0, required by got@10.5.5
npm ERR! missing: responselike@^2.0.0, required by got@10.5.5
npm ERR! missing: to-readable-stream@^2.0.0, required by got@10.5.5
npm ERR! missing: type-fest@^0.9.0, required by got@10.5.5
npm ERR! missing: dns-socket@^4.2.0, required by public-ip@4.0.0
npm ERR! missing: got@^9.6.0, required by public-ip@4.0.0
npm ERR! missing: is-ip@^3.1.0, required by public-ip@4.0.0

Activity

muuvmuuv

muuvmuuv commented on Feb 11, 2020

@muuvmuuv
Author

Equivalent command would be: pnpm list --prod --json (yarn uses the same)

muuvmuuv

muuvmuuv commented on Feb 11, 2020

@muuvmuuv
Author

I guess this requires some rework of the npm.ts script. There is a package that checks which pm was used, maybe something to consider: https://github.com/zkochan/packages/tree/master/which-pm

self-assigned this
on Feb 12, 2020
added
feature-requestRequest for new features or functionality
help wantedIssues identified as good community contribution opportunities
on Feb 12, 2020
empathicqubit

empathicqubit commented on Sep 5, 2020

@empathicqubit

I've been looking at how to make this work. The main issue is that pnpm makes heavy use of symlinks which won't work with the vsix compression, which is just PKZIP.

I've been able to get it to fully work with pnpm install --shamefully-hoist, but that seems less than ideal.

Jack-Works

Jack-Works commented on Mar 13, 2021

@Jack-Works

Having this problem too. I don't want to mix many package managers in a single project

theoparis

theoparis commented on Apr 30, 2021

@theoparis

I just ended up using yarn for my vscode extension, while using pnpm for everything else. Hopefully this will be solved soon.

loucyx

loucyx commented on Jun 12, 2021

@loucyx

vsce should be package manager agnostic. Having it using npm instead of using whatever the dev has is far from ideal. I had to use npm when I use pnpm for everything else:

pnpm i
vsce publish # error

npm ci
vsce publish #works

This worked on previous versions of vsce, so the change mush be kinda recent.

muuvmuuv

muuvmuuv commented on Sep 25, 2021

@muuvmuuv
Author

Oh... I just forgot about my issue about that last year and switched to pnpm again with the same extension xD

Can this get more attention please, since Node allows to have any pm to be the default: https://pnpm.io/installation#nodejs-is-preinstalled

I really don't want to use npm just for one project which would also mean I must remove my alias npm=pnpm line in zshrc :D

softboy99

softboy99 commented on Sep 30, 2021

@softboy99

+1

tjx666

tjx666 commented on Oct 7, 2021

@tjx666

Use pnpm occur problem:

0 verbose cli [
0 verbose cli   '/Users/yutengjing/.nvm/versions/node/v14.18.0/bin/node',
0 verbose cli   '/Users/yutengjing/.nvm/versions/node/v14.18.0/bin/npm',
0 verbose cli   'list',
0 verbose cli   '--production',
0 verbose cli   '--parseable',
0 verbose cli   '--depth=99999',
0 verbose cli   '--loglevel=error'
0 verbose cli ]
1 info using npm@7.24.1
2 info using node@v14.18.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/Users/yutengjing/.nvm/versions/node/v14.18.0/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 verbose config production Use `--omit=dev` instead.
8 timing config:load:cli Completed in 2ms
9 timing config:load:env Completed in 1ms
10 timing config:load:file:/Users/yutengjing/code/vscode-fe-helper/.npmrc Completed in 0ms
11 timing config:load:project Completed in 0ms
12 timing config:load:file:/Users/yutengjing/.npmrc Completed in 3ms
13 timing config:load:user Completed in 3ms
14 timing config:load:file:/Users/yutengjing/.nvm/versions/node/v14.18.0/etc/npmrc Completed in 0ms
15 timing config:load:global Completed in 0ms
16 timing config:load:validate Completed in 1ms
17 timing config:load:credentials Completed in 1ms
18 timing config:load:setEnvs Completed in 0ms
19 timing config:load Completed in 11ms
20 timing npm:load:configload Completed in 11ms
21 timing npm:load:setTitle Completed in 15ms
22 timing npm:load:setupLog Completed in 1ms
23 timing config:load:flatten Completed in 2ms
24 timing npm:load:cleanupLog Completed in 1ms
25 timing npm:load:configScope Completed in 0ms
26 timing npm:load:projectScope Completed in 1ms
27 timing npm:load Completed in 31ms
28 timing arborist:ctor Completed in 2ms
29 timing command:ls Completed in 1547ms
30 verbose stack : @eslint/eslintrc@0.4.3 /Users/yutengjing/code/vscode-fe-helper/node_modules/@eslint/eslintrc
30 verbose stack extraneous: @types/color-name@1.1.1 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/color-name
30 verbose stack extraneous: @types/eslint-scope@3.7.1 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/eslint-scope
30 verbose stack extraneous: @types/json-schema@7.0.9 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/json-schema
30 verbose stack extraneous: @types/json5@0.0.29 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/json5
30 verbose stack extraneous: @types/normalize-package-data@2.4.1 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/normalize-package-data
30 verbose stack extraneous: @types/parse-json@4.0.0 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/parse-json
30 verbose stack extraneous: @types/source-list-map@0.1.2 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/source-list-map
30 verbose stack extraneous: @types/tapable@1.0.8 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/tapable
30 verbose stack extraneous: @types/webpack-sources@3.2.0 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/webpack-sources
30 verbose stack extraneous: @types/yargs-parser@20.2.1 /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/yargs-parser
30 verbose stack extraneous: @typescript-eslint/scope-manager@4.33.0 /Users/yutengjing/code/vscode-fe-helper/node_modules/@typescript-eslint/scope-manager
30 verbose stack extraneous: @typescript-eslint/types@4.33.0 /Users/yutengjing/code/vscode-fe-helper/node_modules/@typescript-eslint/types
30 verbose stack extraneous: @typescript-eslint/visitor-keys@4.33.0 /Users/yutengjing/code/vscode-fe-helper/node_modules/@typescript-eslint/visitor-keys
30 verbose stack extraneous: ast-types@0.14.2 /Users/yutengjing/code/vscode-fe-helper/node_modules/ast-types
30 verbose stack extraneous: eslint-module-utils@2.6.2 /Users/yutengjing/code/vscode-fe-helper/node_modules/eslint-module-utils
30 verbose stack extraneous: eslint-scope@5.1.1 /Users/yutengjing/code/vscode-fe-helper/node_modules/eslint-scope
idleberg

idleberg commented on Nov 22, 2021

@idleberg

vsce should be package manager agnostic. Having it using npm instead of using whatever the dev has is far from idea

In the longterm it should probably use corepack, which was designed for this case:

Corepack is a zero-runtime-dependency Node.js script that acts as a bridge between Node.js projects and the package managers they are intended to be used with during development. In practical terms, Corepack will let you use Yarn and pnpm without having to install them - just like what currently happens with npm, which is shipped by Node.js by default.

via nodejs/corepack

F3n67u

F3n67u commented on Feb 14, 2022

@F3n67u

Below solution works for me:

  1. bundle extension, see https://code.visualstudio.com/api/working-with-extensions/bundling-extension
// this is my package.json
"scripts": {
    "vscode:prepublish": "npm run esbuild-base -- --minify",
    "esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node"
}
  1. add --no-dependencies option to vsce package and vsce publish command(because you already bundled your extension, then there is no need to include npm dependencies when package and publish, all things is in your bundle)
// this is my package.json
"scripts": {
    "package": "pnpm vsce package --no-dependencies",
    "publish": "pnpm vsce publish --no-dependencies"
}

Source: https://zenn.dev/mkizka/articles/a60fcfcf606768

86 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @joaomoreno@iRonin@shellscape@softboy99@evisong

    Issue actions

      Support pnpm · Issue #421 · microsoft/vscode-vsce