-
Notifications
You must be signed in to change notification settings - Fork 3k
npm run
a bin
script
#7137
Comments
I don't think there's anything like that at present, no. The only thing that's somewhat similar is that scripts specified in Can you tell us more about what you're trying to do? There may be some other way to achieve it. |
@smikes thanks for the response. I'm developing a module which will ship with executable scripts. If I put the entries in bin, |
I would probably suggest npm link -g but that would install over the global version. Does the unmodified global version need to exist for the use of other scripts/people? One option might be to use an environment manager such as "nvm" and designate an older version of node as using the devel version of your package and bins... |
Hi again! I'm assuming that this is still a problem, because I'm pretty sure we haven't done anything to change the circumstances. I think this is basically a feature-request, similar to the outstanding request for Another possibility would be for |
This is a feature request, and pretty different from |
Is this the wrong approach? var exec = require('child_process').exec;
var argv = require('process').argv;
var join = require('path').join;
var spawn = require('child_process').spawn;
var firstArgPos = 2; // after 'node' and the name of this script
exec('npm prefix', function(err, prefix, _) {
spawn(join(prefix.trim(), 'node_modules', '.bin', argv[firstArgPos]),
argv.slice(firstArgPos));
// do something with output
}); |
Could this issue be reopened? Installing the script you're developing to be able to run it from that directory seems kinda weird to me. Currently I use this: "script": {
"bin": "same/path/as/bin"
} and then use Also by putting this in the scripts I'm not really sure if this is useful for endusers. |
We're closing this issue as it has gone thirty days without activity. In our experience if an issue has gone thirty days without any activity then it's unlikely to be addressed. In the case of bug reports, often the underlying issue will be addressed but finding related issues is quite difficult and often incomplete. If this was a bug report and it is still relevant then we encourage you to open it again as a new issue. If this was a feature request then you should feel free to open it again, or even better open a PR. For more information about our new issue aging policies and why we've instituted them please see our blog post. |
@Haroenv just a note: you can "simplify" (not sure it's actually simpler) that script to |
I'm using Yarn now, which has this feature |
@Haroenv How? |
@Haroenv agree, I'd like to see that working in yarn. Personally, I follow a pattern of making the
No repetition of path that way. And if using the object form:
|
Suppose my package.json looked like
Is there a subcommand
npm _____ foo
that will execute the script? I'm in development, so the symlinks dont exist, and I really don't want to perform some link jujutsu to get this to work. I'd hope thatnpm bin foo
would work but that does something differentThe text was updated successfully, but these errors were encountered: