-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Bugthing that needs fixingthing that needs fixing
Description
The bin
section in the package.json documentation says
On install, npm will symlink that file into prefix/bin for global installs, or ./node_modules/.bin/ for local installs.
However, that does not seem to happen.
Repro
$ cat package.json
{
"name": "bin-install-repro",
"version": "1.0.0",
"private": true,
"description": "",
"scripts": {
"tsc": "tsc",
"main": "main"
},
"bin": {
"main": "./main.js"
},
"author": "",
"license": "",
"dependencies": {}
}
$ cat main.js
#!/usr/bin/env node
console.log("hello universe");
$ npm install .
up to date in 0.445s
found 0 vulnerabilities
$ npm run main
> [email protected] main /home/jp/dev/bin-install-issue
> main
sh: main: command not found
$ ls $(npm bin)
total 0
As we know this can be achieved with npm link
, which is documented with
It will also link any bins in the package to {prefix}/bin/{name}.
$ npm link
...
$ npm run main
> [email protected] main /home/jp/dev/bin-install-issue
> main
hello universe
Environment
$ node --version
v12.13.1
$ npm --version
6.12.1
Is the documentation bad, or the implementation? :)
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixing