Skip to content
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

vsce finding wrong files without --yarn option #381

Closed
flimberger opened this issue Aug 8, 2019 · 13 comments
Closed

vsce finding wrong files without --yarn option #381

flimberger opened this issue Aug 8, 2019 · 13 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@flimberger
Copy link

When packaging my extension, vsce failed with the following error message:

$ vsce package
This extension consists of 20743 separate files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension. You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
 ERROR  invalid relative path: extension/../../../../lib/nodejs/lib/node_modules/generator-code/.azure-pipelines.yml

Running vsce reveals that it tries to pack up the whole global node_modules directory of my user:

$ vsce ls
../../../../lib/nodejs/lib/node_modules/generator-code/.azure-pipelines.yml
../../../../lib/nodejs/lib/node_modules/generator-code/generators/app/env.js
[... 20737 more lines ...]
../../../../lib/nodejs/lib/node_modules/yo/node_modules/wrap-ansi/node_modules/ansi-regex/package.json
../../../../lib/nodejs/lib/node_modules/yo/node_modules/wrap-ansi/node_modules/ansi-regex/readme.md

Adding the --yarn flag produces the expected behaviour and works in the current directory:

$ vsce ls --yarn
CHANGELOG.md
language-configuration.json
LICENSE
Makefile
package.json
README.md
syntaxes/blueprint.tmLanguage.json
$ vsce package --yarn
 DONE  Packaged: /home/flimberger/devel/plugins/vscode/android-system-tools/android-system-tools-0.0.2.vsix (9 files, 5.17KB)

My extension doesn't contain any code, therefore I expected the packaging progess to be agnostic to whether npm or yarn is used.

Platform: Ubuntu 18.04
Version: 1.66.0
Environment:

NPM_CONFIG_PREFIX="$HOME/lib/nodejs"
NPM_CONFIG_USERCONFIG="$HOME/lib/config/npmrc"
NODE_PATH="$NPM_CONFIG_PREFIX/lib/node_modules:/usr/lib/nodejs"
PATH="$NPM_CONFIG_PREFIX/bin:$PATH"

NPM configuration:

global=true
@joaomoreno
Copy link
Member

My extension doesn't contain any code, therefore I expected the packaging progess to be agnostic to whether npm or yarn is used.

Does it have a package.json? Does it have any dependencies? Can you show me the sources of your extension?

@joaomoreno joaomoreno self-assigned this Aug 9, 2019
@joaomoreno joaomoreno added the info-needed Issue requires more information from poster label Aug 9, 2019
@flimberger
Copy link
Author

The extension is here, the package.json in question was mainly generated by yeoman, with some additional info by myself:

{
    "name": "android-system-tools",
    "displayName": "Android System Tools",
    "description": "Syntax support for file formats used in Android system development.",
    "version": "0.0.2",
    "publisher": "flimberger",
    "repository": {
        "type": "git",
        "url": "git+https://github.com/flimberger/android-system-tools.git"
    },
    "license": "BSD-2-Clause",
    "engines": {
        "vscode": "^1.36.0"
    },
    "categories": [
        "Programming Languages"
    ],
    "contributes": {
        "languages": [{
            "id": "blueprint",
            "aliases": ["Android Blueprint", "blueprint"],
            "extensions": [".bp"],
            "configuration": "./language-configuration.json"
        }],
        "grammars": [{
            "language": "blueprint",
            "scopeName": "source.bp",
            "path": "./syntaxes/blueprint.tmLanguage.json"
        }]
    }
}

@joaomoreno
Copy link
Member

This packages just fine for me. Do you have more files in your local copy of that repository? Any symlinks?

@flimberger
Copy link
Author

No symlinks in the repo, but I've moved the npm stuff with the NPM_CONFIG_PREFIX environment variable from the default locations. I will test without these redirections.

@justinfagnani
Copy link

I'm having the same problem in a monorepo that does have symlink to the sibling packages, but where I'm trying to ignore them by including node_modules in the .vscodeignore file. It seems like the node_modules isn't working, or the "invalid relative path" error is being emitted before ignoring files.

@joaomoreno
Copy link
Member

@flimberger Is this still problematic?

@flimberger
Copy link
Author

I have to check again, but in the meantime my platform migrated to Ubuntu 20.04. I will get back to you when I tested it.

@joaomoreno
Copy link
Member

Sure, let me know.

@acccrop
Copy link

acccrop commented Feb 9, 2022

I also have the same problem. is there a solution to this?

@flimberger
Copy link
Author

I cannot reproduce the issue anymore with vsce version 2.7.0 and node version v16.15.0 installed from snap on Ubuntu 20.04.

@flimberger
Copy link
Author

That assessment was too soon, running vsce package asks if it should continue, since no license file can be found. If I continue, the package does not contain the extension directory. So unfortunately the issue is not fixed.

@redonkulus
Copy link

Was getting this same issue and --yarn worked for me until recently, I noticed using the --no-dependencies option avoided this issue as well.

@nagilson
Copy link
Member

nagilson commented Oct 4, 2022

Experiencing the same issue because of npm links, might be related to #308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

6 participants