Skip to content

Support pnpm #421

Closed as not planned
Closed as not planned

Description

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 [email protected]
npm ERR! missing: @szmarczak/http-timer@^4.0.0, required by [email protected]
npm ERR! missing: @types/cacheable-request@^6.0.1, required by [email protected]
npm ERR! missing: cacheable-lookup@^2.0.0, required by [email protected]
npm ERR! missing: cacheable-request@^7.0.1, required by [email protected]
npm ERR! missing: decompress-response@^5.0.0, required by [email protected]
npm ERR! missing: duplexer3@^0.1.4, required by [email protected]
npm ERR! missing: get-stream@^5.0.0, required by [email protected]
npm ERR! missing: lowercase-keys@^2.0.0, required by [email protected]
npm ERR! missing: mimic-response@^2.0.0, required by [email protected]
npm ERR! missing: p-cancelable@^2.0.0, required by [email protected]
npm ERR! missing: p-event@^4.0.0, required by [email protected]
npm ERR! missing: responselike@^2.0.0, required by [email protected]
npm ERR! missing: to-readable-stream@^2.0.0, required by [email protected]
npm ERR! missing: type-fest@^0.9.0, required by [email protected]
npm ERR! missing: dns-socket@^4.2.0, required by [email protected]
npm ERR! missing: got@^9.6.0, required by [email protected]
npm ERR! missing: is-ip@^3.1.0, required by [email protected]

Activity

  1. muuvmuuv commented on Feb 11, 2020

    @muuvmuuv
    Author

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

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

  3. added
    feature-request
    help wanted
    on Feb 12, 2020
  4. 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.

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

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

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

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

  9. softboy99 commented on Sep 30, 2021

    @softboy99

    +1

  10. 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 [email protected]
    2 info using [email protected]
    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/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@eslint/eslintrc
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/color-name
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/eslint-scope
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/json-schema
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/json5
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/normalize-package-data
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/parse-json
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/source-list-map
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/tapable
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/webpack-sources
    30 verbose stack extraneous: @types/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@types/yargs-parser
    30 verbose stack extraneous: @typescript-eslint/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@typescript-eslint/scope-manager
    30 verbose stack extraneous: @typescript-eslint/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@typescript-eslint/types
    30 verbose stack extraneous: @typescript-eslint/[email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/@typescript-eslint/visitor-keys
    30 verbose stack extraneous: [email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/ast-types
    30 verbose stack extraneous: [email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/eslint-module-utils
    30 verbose stack extraneous: [email protected] /Users/yutengjing/code/vscode-fe-helper/node_modules/eslint-scope
    
  11. 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

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

  13. johnsoncodehk commented on Feb 15, 2022

    @johnsoncodehk

    Feng Yu (@F3n67u) done, thank you!

    If someone need to reference:

  14. 65 remaining items

  15. danielbayley commented on Jan 15, 2026

    @danielbayley

    Hey folks, I built vsce-pnpm to fix this, and I also added support for pnpm symlinks.

    Nice yyyanghj (@yyyanghj)! Could this be turned into a PR here?

  16. lra8dev commented on Jan 28, 2026

    @lra8dev

    Try this one:

    pnpm dlx @vscode/vsce package --no-dependencies
  17. trancexpress commented on Jun 4, 2026

    @trancexpress

    Are there any workarounds when npm is not installed at all?

    Executing prepublish script 'npm run vscode:prepublish'...
    /bin/sh: line 1: npm: command not found
    

    Seems like removing the prepublish part in scripts avoids the error:

       "scripts": {
    -    "vscode:prepublish"
    

    Should be enough for my case...

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions