Npm `bin` field is not exported in published metadata

Try to publish a trivial npm package with a bin field:

{
    "name": "@user/package",
    "version": "1.0.0",
    "repository": {
        "type": "git",
        "url": "git://github.com/user/package.git"
    },
    "bin": "bin.js"
}

Then try to retrieve the related metadata from:

https://npm.pkg.github.com/@user/package

You’ll notice that the bin field has disappeared.

This behavior is very annoying when it comes to tools that rely on these metadata.
For example, yarn (berry) 2 is such a tool, and as a consequence, commands like yarn dlx do not work at all because of the lack of the bin field in the published metadata.

1 Like