'Error package vscode extension with vsce: invalid relative path

  • npm: 8.1.0
  • vsce: 2.5.3

I have a npm package (colibri) in a local folder and a VSCode extension (vscode-teroshdl) in other folder. colibri is a dependency of vscode-teroshdl:

    "dependencies": {
        "colibri": "file:../colibri"
    },

When I try to package the VSCode extension:

cd colibri
npm install
cd ../vscode-terosHDL
npm install
vsce package

It fails with the error:

 ERROR  invalid relative path: extension/../colibri/node_modules/cli-progress/CHANGES.md


Solution 1:[1]

It's almost certainly this bug: https://github.com/microsoft/vscode-vsce/issues/381 as I just encountered it while trying to package ansible-vscode, which uses symlinks

As mentioned in that issue, I found that running vsce package --yarn (even without yarn-specific files in the working copy) caused it to package as expected.

This was with node v17.6.0 darwin/amd64 and vsce 1.96.1. While testing this, I noticed my vsce was old, but I had the same experience on 2.6.7, which is the latest

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mdaniel