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

Have NPM as a runtime dependency #246

Closed
ribrdb opened this issue Mar 19, 2018 · 22 comments
Closed

Have NPM as a runtime dependency #246

ribrdb opened this issue Mar 19, 2018 · 22 comments
Assignees
Labels
feature-request Request for new features or functionality out-of-scope

Comments

@ribrdb
Copy link

ribrdb commented Mar 19, 2018

I'm trying to package my extension based on the lsp-sample. I run vsce package in the client directory and it says:

$ vsce package
Executing prepublish script 'npm run vscode:prepublish'...

> vscode-closure-completion-client@0.0.1 vscode:prepublish /Volumes/Seagate/Users2/ribrdb/Developer/vscode-extension-samples-master/lsp-sample/client
> ../node_modules/.bin/tsc -p ./

Error: Command failed: npm list --production --parseable --depth=99999
npm ERR! missing: block-stream@https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz, required by tar@2.2.1
npm ERR! missing: inherits@https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz, required by block-stream@https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz
@joaomoreno
Copy link
Member

If you run npm list --production --parseable --depth=99999, what happens?

@joaomoreno joaomoreno self-assigned this Mar 19, 2018
@marquesmps
Copy link

I am having the same problem. When I run that command I get:

$ npm list --production --parseable --depth=99999
npm ERR! missing: graceful-readlink@1.0.1, required by commander@2.9.0
npm ERR! missing: argparse@1.0.10, required by js-yaml@3.2.7
npm ERR! missing: esprima@2.0.0, required by js-yaml@3.2.7
npm ERR! missing: sprintf-js@1.0.3, required by argparse@1.0.10
npm ERR! missing: docker-modem@1.0.6, required by dockerode@2.5.4
npm ERR! missing: concat-stream@1.5.2, required by dockerode@2.5.4
npm ERR! missing: tar-fs@1.12.0, required by dockerode@2.5.4
npm ERR! missing: JSONStream@1.3.2, required by docker-modem@1.0.6
npm ERR! missing: debug@3.1.0, required by docker-modem@1.0.6
npm ERR! missing: readable-stream@1.0.34, required by docker-modem@1.0.6
npm ERR! missing: split-ca@1.0.1, required by docker-modem@1.0.6
npm ERR! missing: jsonparse@1.3.1, required by JSONStream@1.3.2
npm ERR! missing: through@2.3.8, required by JSONStream@1.3.2
npm ERR! missing: ms@2.0.0, required by debug@3.1.0
npm ERR! missing: core-util-is@1.0.2, required by readable-stream@1.0.34
npm ERR! missing: isarray@0.0.1, required by readable-stream@1.0.34
npm ERR! missing: string_decoder@0.10.31, required by readable-stream@1.0.34
npm ERR! missing: inherits@2.0.3, required by readable-stream@1.0.34
npm ERR! missing: readable-stream@2.0.6, required by concat-stream@1.5.2
npm ERR! missing: inherits@2.0.3, required by concat-stream@1.5.2
npm ERR! missing: typedarray@0.0.6, required by concat-stream@1.5.2
npm ERR! missing: core-util-is@1.0.2, required by readable-stream@2.0.6
npm ERR! missing: process-nextick-args@1.0.7, required by readable-stream@2.0.6
npm ERR! missing: string_decoder@0.10.31, required by readable-stream@2.0.6
npm ERR! missing: inherits@2.0.3, required by readable-stream@2.0.6
npm ERR! missing: isarray@1.0.0, required by readable-stream@2.0.6
npm ERR! missing: util-deprecate@1.0.2, required by readable-stream@2.0.6
npm ERR! missing: mkdirp@0.5.1, required by tar-fs@1.12.0
npm ERR! missing: pump@1.0.3, required by tar-fs@1.12.0
npm ERR! missing: tar-stream@1.5.5, required by tar-fs@1.12.0
npm ERR! missing: minimist@0.0.8, required by mkdirp@0.5.1
npm ERR! missing: end-of-stream@1.4.1, required by pump@1.0.3
npm ERR! missing: once@1.4.0, required by pump@1.0.3
npm ERR! missing: once@1.4.0, required by end-of-stream@1.4.1
npm ERR! missing: wrappy@1.0.2, required by once@1.4.0
npm ERR! missing: bl@1.2.1, required by tar-stream@1.5.5
npm ERR! missing: end-of-stream@1.4.1, required by tar-stream@1.5.5
npm ERR! missing: readable-stream@2.3.5, required by tar-stream@1.5.5
npm ERR! missing: xtend@4.0.1, required by tar-stream@1.5.5
npm ERR! missing: readable-stream@2.3.5, required by bl@1.2.1
npm ERR! missing: core-util-is@1.0.2, required by readable-stream@2.3.5
npm ERR! missing: inherits@2.0.3, required by readable-stream@2.3.5
npm ERR! missing: isarray@1.0.0, required by readable-stream@2.3.5
npm ERR! missing: process-nextick-args@2.0.0, required by readable-stream@2.3.5
npm ERR! missing: safe-buffer@5.1.1, required by readable-stream@2.3.5
npm ERR! missing: string_decoder@1.0.3, required by readable-stream@2.3.5
npm ERR! missing: util-deprecate@1.0.2, required by readable-stream@2.3.5
npm ERR! missing: safe-buffer@5.1.1, required by string_decoder@1.0.3
npm ERR! missing: async@1.0.0, required by winston@2.4.1
npm ERR! missing: colors@1.0.3, required by winston@2.4.1
npm ERR! missing: cycle@1.0.3, required by winston@2.4.1
npm ERR! missing: eyes@0.1.8, required by winston@2.4.1
npm ERR! missing: isstream@0.1.2, required by winston@2.4.1
npm ERR! missing: stack-trace@0.0.10, required by winston@2.4.1

@joaomoreno
Copy link
Member

Did you run npm install?

@hbenl
Copy link

hbenl commented Apr 8, 2018

I had the same issue, apparently it's caused by npm/npm#19393. I was able to work around it by downgrading npm: npm install -g npm@5.5.1

@hbenl
Copy link

hbenl commented Apr 8, 2018

Another workaround mentioned in npm/npm#19393 that worked for me (with npm version 5.8.0): rm -Rf node_modules/ package-lock.json ; npm install --no-optional

@joaomoreno
Copy link
Member

Good to know!

@hbenl
Copy link

hbenl commented Jun 2, 2018

After updating the dependencies for my extension, the npm install --no-optional workaround didn't work for me anymore. So now the only workaround that works for me is downgrading npm.
The npm authors are showing zero interest in this bug: lots of users are confirming this problem, but after almost half a year there is not a single response from them.
Maybe you should consider finding a workaround for this that can be built into vsce: more and more extension authors are going to get hit by this (because more and more packages make use of optional dependencies) and having to tell extension authors that they can't publish their extensions with a current version of npm seems... weird.

@joaomoreno
Copy link
Member

@hbenl Thanks, that's good to know. Maybe VSCE should depend on a specific NPM version?

@hbenl
Copy link

hbenl commented Jun 4, 2018

@joaomoreno I'm afraid that wouldn't solve the problem: if an extension developer has a newer version of npm installed globally and uses that to install the dependencies of his extension then every version of npm will fail on npm ls in that folder. At least that's the experience I had when downgrading to npm@5.5.1: npm ls (and hence vsce publish) still failed until I reinstalled my dependencies with the downgraded npm.

@joaomoreno
Copy link
Member

Sorry, that was a confusing comment. I meant: let's add NPM as a node dependency to VSCE. That way we can lock it and use it as a library as well.

@hbenl
Copy link

hbenl commented Jun 5, 2018

Actually I think I had understood you correctly, but apparently my comment wasn't clear enough :)
I guess I should explain in more detail what I think is happening: npm@5.6.0 made a slight change to how npm install works (see the first feature mentioned here). Due to a bug described in detail in npm/npm#19428, npm ls can't make sense of the result of npm install.

So it doesn't matter what version of npm you use to run npm ls, they will all fail if a recent version of npm was used to do npm install. If you add npm as a node dependency to vsce and use that to do npm ls, nothing changes. You'd need to control the version of npm that is used to do npm install, i.e. the version of npm that the user has installed globally.

So what can be done? First of all, you could try to detect if npm ls fails due to this issue and tell the user what he can do (downgrade npm and reinstall his dependencies with the downgraded version) and link to this issue. You could also add "npm" : "<5.6.0" to the engines field in the package.json of vsce - that should produce a warning message if a user runs npm install with a new version of npm in a project that lists vsce as a dependency.

Apart from that, I don't see an easy solution: vsce needs a working implementation of npm ls. Since no version of npm seems to have a fully functional implementation, maybe you could find one elsewhere? I was thinking about yarn list, but that doesn't have the --production flag, which I guess is crucial for vsce.
If no such implementation can be found, someone would have to create one or fix the implementation in npm. But that seems like a lot of work for an issue that has not hit that many users - so far.

@joaomoreno joaomoreno reopened this Jun 5, 2018
@joaomoreno joaomoreno added this to the Backlog milestone Jun 5, 2018
@uudashr
Copy link

uudashr commented Jun 12, 2018

It happen to me when using yarn. Is it possible to give options for using yarn instead of npm?

@joaomoreno
Copy link
Member

@uudashr --yarn

@uudashr
Copy link

uudashr commented Jun 12, 2018

Ahh... thanks

$ vsce package --yarn
Executing prepublish script 'npm run vscode:prepublish'...

The console output still using npm, but it works.

@joaomoreno joaomoreno changed the title vsce package fails Have NPM as a runtime dependency Sep 20, 2018
@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Sep 20, 2018
@jasonHzq
Copy link

It works for me to run:

vsce publish --yarn

@OBKoro1
Copy link

OBKoro1 commented Jan 21, 2019

vsce package --yarn Solved my problem

mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
mickeypearce added a commit to mickeypearce/oradew-vscode that referenced this issue Feb 6, 2019
@mickeypearce
Copy link

It solved my problem as well and sorry for references. They weren't intentional.

@meilZhu
Copy link

meilZhu commented Aug 28, 2020

Hello! At first, when I packaged the vscode plug-in, I reported an error as follows

Error: Command failed: npm list --production --parseable --depth=99999`
npm ERR! missing: lodash@, required by kissy-xtemplate@0.4.3

However, according to the feedback from GitHub, it was the NPM version problem. I said that NPM version 5.5.1 was needed. However, after the version was changed here, the following errors appeared again

report errors

ERROR Command failed: npm list --production --parseable --depth=99999 --loglevel=error
npm ERR! cb.apply is not a function

@meilZhu
Copy link

meilZhu commented Aug 28, 2020

I found that the error is not only related to the NPM version, but also to the location of the dependent package and the dev dependent package

@tamj0rd2
Copy link

tamj0rd2 commented Jan 10, 2021

I found that the error is not only related to the NPM version, but also to the location of the dependent package and the dev dependent package

What was the relation and how did you fix it? I'm having the same issue and I specifically need to use npm as my package manager rather than yarn

@dnicolson
Copy link

For vsce package --yarn to work, Yarn must be installed and run at least once. Without a yarn.lock file the node_modules directory won't be included in the vsix archive.

Here are the full steps for both npm and Yarn:

npm

npm uninstall -g npm
npm install -g npm@5.5.1
npm install
vsce package

Yarn

npm install -g yarn
yarn
vsce package --yarn

quilicicf added a commit to quilicicf/vscode-markdown-spec-formatter that referenced this issue Aug 23, 2021
akosyakov added a commit to open-vsx/publish-extensions that referenced this issue Sep 10, 2021
@joaomoreno
Copy link
Member

Thinking about it, I think adding npm as a dependency to vsce is a bad idea. People use different versions of it, or even different tools such as yarn. Closing as out of scope.

tennox pushed a commit to tennox/publish-extensions that referenced this issue Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality out-of-scope
Projects
None yet
Development

No branches or pull requests