Skip to content

[BUG] Misleading documentation on package.json:bin #3788

@0x2b3bfa0

Description

@0x2b3bfa0

What / Why

Documentation states the following:

To use this, supply a bin field in your package.json which is a map of command name to local file name. When this package is installed globally, that file will be linked where global bins go so it is available to run by name. (quote from the documentation)

Unfortunately, this is not true for Windows, where it doesn't use symbolic links, but rather a custom script generated by the cmd-shim package.

When

  • running npm install

Where

How

Steps to Reproduce

main.js

const [, file, ...parameters] = process.argv;
console.log(require('path').basename(file));

package.json

{
  "bin": {
    "one": "main.js",
    "two": "main.js"
  }
  ···
}

Current Behavior

Running one will print main.js on Windows and one on every other platform.

Expected Behavior

Running one should print one on every platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💎 Free Internet Points 💎similar to "Good First issue" - although more impactfulBugthing that needs fixingDocumentationdocumentation related issueGood First Issuegood issue or PR for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions