Skip to content

Commit 339145f

Browse files
committed
fix(docs): clarify what install type gets .bins
"on install" was ambiguous because it wasn't clear if it meant "when npm install is ran on this project" or "when this project is installed somewhere else" PR-URL: #3491 Credit: @wraithgar Close: #3491 Reviewed-by: @ljharb
1 parent 665a7bd commit 339145f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

docs/content/configuring-npm/folders.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ Global installs on Windows go to `{prefix}/node_modules` (that is, no
4545
Scoped packages are installed the same way, except they are grouped together
4646
in a sub-folder of the relevant `node_modules` folder with the name of that
4747
scope prefix by the @ symbol, e.g. `npm install @myorg/package` would place
48-
the package in `{prefix}/node_modules/@myorg/package`. See [`scope`](/using-npm/scope) for more details.
48+
the package in `{prefix}/node_modules/@myorg/package`. See
49+
[`scope`](/using-npm/scope) for more details.
4950

5051
If you wish to `require()` a package, then install it locally.
5152

5253
#### Executables
5354

5455
When in global mode, executables are linked into `{prefix}/bin` on Unix,
55-
or directly into `{prefix}` on Windows.
56+
or directly into `{prefix}` on Windows. Ensure that path is in your
57+
terminal's `PATH` environment to run them.
5658

5759
When in local mode, executables are linked into
5860
`./node_modules/.bin` so that they can be made available to scripts run

docs/content/configuring-npm/package-json.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,12 @@ install into the PATH. npm makes this pretty easy (in fact, it uses this
341341
feature to install the "npm" executable.)
342342

343343
To use this, supply a `bin` field in your package.json which is a map of
344-
command name to local file name. On install, npm will symlink that file
345-
into `prefix/bin` for global installs, or `./node_modules/.bin/` for local
346-
installs.
344+
command name to local file name. When this package is installed
345+
globally, that file will be linked where global bins go so it is
346+
available to run by name. When this package is installed as a
347+
dependency in another package, the file will be linked where it will be
348+
available to that package either directly by `npm exec` or by name in other
349+
scripts when invoking them via `npm run-script`.
347350

348351

349352
For example, myapp could have this:
@@ -388,6 +391,9 @@ executable!
388391

389392
Note that you can also set the executable files using [directories.bin](#directoriesbin).
390393

394+
See [folders](/configuring-npm/folders#executables) for more info on
395+
executables.
396+
391397
### man
392398

393399
Specify either a single file or an array of filenames to put in place for

0 commit comments

Comments
 (0)