-
Notifications
You must be signed in to change notification settings - Fork 330
Closed
Description
Reproduction Steps
-
Create a simple npm package.
package.json{ "name": "my-pkg", "version": "0.0.1", "bin": { "my-cmd": "./index.mjs" }, "main": "./index.mjs" }index.mjs#!/usr/bin/env node console.log(process.argv);
-
Install this package globally with
npm.npm i -g ./my-pkg/
-
Run
my-cmdwith-hor--helparguments (e.g.my-cmd -h).⇒ Then, Volta outputs the
volta runhelp message.$ my-cmd -h Run a command with custom Node, npm, pnpm, and/or Yarn versions Usage: volta.exe run [OPTIONS] <COMMAND> [ARGS]... Arguments: <COMMAND> The command to run [ARGS]... Arguments to pass to the command Options: --node <version> Set the custom Node version --npm <version> Set the custom npm version --bundled-npm Forces npm to be the version bundled with Node --pnpm <version> Set the custon pnpm version --no-pnpm Disables pnpm --yarn <version> Set the custom Yarn version --no-yarn Disables Yarn --env <NAME=value> Set an environment variable (can be used multiple times) --verbose Enables verbose diagnostics --very-verbose Enables trace-level diagnostics --quiet Prevents unnecessary output -h, --help Print help
Note that I have confirmed that the behavior is as expected when
my-cmdis run without any arguments.
Consideration
The following script exists in ${LOCALAPPDATA}/Volta/bin/my-cmd.
#!/bin/bash
volta run "$(basename $0)" "$@"This is my guess, but I suspect that the "$@" arguments that should be passed to the package are being interpreted as volta run arguments.
In fact, after modifying the script as follows (simply adding --), this issue no longer occurs.
@@ -1,2 +1,2 @@
#!/bin/bash
-volta run "$(basename $0)" "$@"
+volta run -- "$(basename $0)" "$@"I am not sure if this workaround is universally correct, so I would appreciate your consideration of a safe fix for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels