Repository navigation
deps: Including additional binaries with npm? #13640
Description
Activity
To be clear, "binaries" here doesn't mean actual compiled executables/addons but instead node script files, right?
- addednpmIssues and PRs related to the npm client dependency or the npm registry.Issues and PRs related to the npm client dependency or the npm registry.discussIssues opened for discussion and feedback.Issues opened for discussion and feedback.
on Jun 12, 2017 @mscdex yes, I'm using
binariesin the npm parlance sense -- executables. In this case, it's definitely just a node script.Did you check for name conflicts with existing programs? I didn't find anything called 'npx' in apt (debian) but that's not exhaustive.
No result on Fedora with
dnf search npxanddnf provides npx.Nothing on
chocolatey🤣There is no default formula for any
npxbinaries.This does mean shipping another dep though with all the same weird caveats that shipping npm has (albeit
npxis much smaller because it usednpm).This does mean shipping another dep though with all the same weird caveats that shipping npm has
Presumably it'll be included in the npm source, so it won't be a separate folder in
deps/or anything, just another dependency in our npm updates.I interpreted that comment as needing to update installers, etc. I'm curious if distro vendors would package it.
Presumably it'll be included in the npm source, so it won't be a separate folder in deps/ or anything, just another dependency in our npm updates.
I do not think this is the case,
npxis it's own module?I checked this originally when I chose the
npxname, and there doesn't seem to be any such package on the couple of distros I checked, nor any real conflicts anywhere. I'm also the owner of npm.im/npx itself, so it's fine to clobber it with npm's own (and vice-versa).It will be included with the npm sources, and installed alongside the regular
npmbinary. It will be an additionalbinentry in npm's ownpackage.json(essentially a re-export script). We're bundling npx with npm -- so it won't be an extra entry indeps/, it'll be indeps/npm/node_modules/npx.Reacted by Refael Ackermannit looks like this is going to be coming in a future semver minor of npm. If we plan to ship this we need to ensure it ends up in the binary as expected and is installed properly by the double click installers
Reacted by Refael Ackermann@zkat what do you see the install formula being? i.e. if the
npmlands as a zip, what will create the binary shims, or will they be already packed in the zip?For our Unix
tools/install.pythis is the relevant bit that creates/removes the npm bin symlinks:Lines 92 to 99 in 23498f2
# create/remove symlink link_path = abspath(install_path, 'bin/npm') if action == uninstall: action([link_path], 'bin/npm') elif action == install: try_symlink('../lib/node_modules/npm/bin/npm-cli.js', link_path) else: assert(0) # unhandled action type The windows MSI installer currently has only directives for the
npmshims - https://github.com/nodejs/node/blob/master/tools/msvs/msi/product.wxs#L210-L216I haven't added the built-in shims yet, but I think it's safe to assume right now that they'll mirror the npm ones, but replacing
npmwithnpx. I'm literally just gonna copy them over and frob them into npx-ness, but I want to confirm that this is the right thing to do before I get around to that. This bit of npm is newer to me.Reacted by Refael AckermannThe PR is up for your consideration, curiosity, and merge bit ;)
I am not sure this is the right place to raise this, or if I am in any position to do so, but as I haven't seen anyone present this view, I am going to take the liberty to do so anyway.
Something like
npmobviously needs to be bundled with node, but I don't think the same is true for a package likenpx. Why is it not just a userland package that people can opt to install themselves?If this question has been discussed in other places, I apologize for missing it.
To make it perfectly clear, I am an npm-fanboy myself (I think
npmis far more attractive thanyarnetc) and I'm most likely going to be very happy withnpxas well. I built a similar thing myself - my version was callednrand was a lot simpler - just a bash function aroundnpm bin.Reacted by Andreas LindReacted by Refael AckermannI am not sure this is the right place to raise this, or if I am in any position to do so, but as I haven't seen anyone present this view, I am going to take the liberty to do so anyway.
Something like npm obviously needs to be bundled with node, but I don't think the same is true for a package like npx. Why is it not just a userland package that people can opt to install themselves?
-
IMHO users' input is of equal or even higher value than the academic musings of the inner-circle people, so more power to you ✊
-
(just my "academic" musings) in node core's context, it's
npm's choice. If "they" decided to bundle it in the default bundle, then we should follow suit. So maybe a better thread is npx: bundle npx with npm itself npm/npm#17685 🤷♂️
P.S. As I mentioned above I also implemented a similar "hack" by adding
:./node_codule/.bin:to myPATH.-
I am +1 to bundling
npx. At Help.com, we use the official tarballs in docker images and our CI uses a docker-compose like tool to run our test suites. To avoid manually installing all of our dependencies twice (to get the tool to run the test suite and in the docker container), we have tonpm install <tool>and then run it. Includingnpxwould greatly simplify this process for us as we wouldn't have to bake it into the docker image ourselves.Sorry but I don't use npx and don't want my cli autocomplete polluted with it. Installing npx from npm isn't that much of hassle and if someone wants to use it they can install it in a few seconds.
Reacted by Fernando MontoyaSorry but I don't use npx and don't want my cli autocomplete polluted with it. Installing npx from npm isn't that much of hassle and if someone wants to use it they can install it in a few seconds.
Seems like something to take up with
npm(see npm/npm#17685). AIUI the npm team think this should be available by default, and if you don't like it you can always uninstall it in a few seconds.To be clear, I haven't actually used
npx, so I don't have an opinion on bundling it.@mohsen1 Your CLI autocomplete isn't polluted by default, only by choice IIRC.
Reacted by Mohsen Azimi- Reacted by Gibson Fahnestock
npxlanded withnpm5.3.0 in #14235 and released in Node.js 8.2.0.

Hey y'all!
So, the npm team is planning on bundling npx with the standard npm distribution sometime soonish. We figured we should let y'all know asap so we can start having a conversation about how this would affect your own distribution (if at all), and if there's anything you need from us to get this to work -- since right now, we only ship the
npmbinary, and this would mean an additionalnpxgetting installed into users' bin dir.idk if there's much to say here besides that! If this is just fine, feel free to close it, and we'll give y'all a heads up when we push a version of npm with npx bundled into it (in the next month or so). We think npx is gonna be a pretty core/important tool for npm users, since it'll give everyone easier access to the various CLI tools available in the npm registry, as well as solve a long-standing problem where there's been no standardised way to invoke devDependency binaries while working interactively.