-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Is there an existing issue for this?
- I have searched the existing issues1
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
For a package with a bin script that contains the character . in the name2 it cannot be executed with npx/npm exec from a Windows machine. Rather than executing the script, Windows attempts to open the file and search for a application based on the extension.
This is not an issue on other operating systems.
Expected Behavior
The npx/npm exec behavior for bin scripts should be the same for all operating systems. You should be able to call any of the bin scripts in a package.
Steps To Reproduce
Reproduction contained in this repo: https://github.com/molisani/npm-windows-bin-issue
- Update package with a bin script with
.in the name - Attempt to run
npm exec --package=<package> <bin-name>from Windows - See that it attempts to open
<bin-name>as a file
Environment
- npm: 11.5.2
- Node.js: 22.14.0
- OS Name: Windows 10 Enterprise
- System Model Name: Thinkpad X1 Extreme Gen 4
- npm config:
; "builtin" config from C:\Users\mmolisani\AppData\Roaming\npm\node_modules\npm\npmrc
; prefix = "C:\\Users\\mmolisani\\AppData\\Roaming\\npm" ; overridden by user
; "user" config from C:\Users\mmolisani\.npmrc
audit = false
engine-strict = true
prefix = "C:\\Users\\mmolisani\\AppData\\Roaming\\npm"
; registry = [[REDACTED]] ; overridden by env
strict-ssl = false
; "env" config from environment
registry = [[REDACTED]]
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v22.14.0
; npm local prefix = C:\code\github\npm-windows-bin-issue
; npm version = 11.5.2
; cwd = C:\code\github\npm-windows-bin-issue
; HOME = C:\Users\mmolisani
; Run `npm config ls -l` to show all defaults.Footnotes
-
There was a previous issue opened for the same problem (https://github.com/npm/cli/issues/4445) but that was closed in favor of an issue on the
npm/execrepo (https://github.com/npm/exec/issues/17). However, that issue was automatically closed when that repo was archived, so I am creating this new issue to make sure that this is still tracked as an open bug. ↩ -
Please note that this also extends to packages that contain
.in their name, if they have a single bin script. For example, a package@org/namespace.foowith"bin": "script.js"would be impossible to run withnpx @org/namespace.foo. ↩