Skip to content

Commit 20c83fa

Browse files
authored
docs: update docs for npm install <folder> (#4428)
npm install <folder> doesn't install dependencies if <folder> is outside of root project. Fixes #3358
1 parent 20a9818 commit 20c83fa

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

docs/content/commands/npm-install.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,20 @@ into a tarball (b).
7878

7979
* `npm install <folder>`:
8080

81-
Install the package in the directory as a symlink in the current
82-
project. Its dependencies will be installed before it's linked. If
83-
`<folder>` sits inside the root of your project, its dependencies may
81+
If `<folder>` sits inside the root of your project, its dependencies will be installed and may
8482
be hoisted to the top-level `node_modules` as they would for other
85-
types of dependencies.
83+
types of dependencies. If `<folder>` sits outside the root of your project,
84+
*npm will not install the package dependencies* in the directory `<folder>`,
85+
but it will create a symlink to `<folder>`.
86+
87+
> NOTE: If you want to install the content of a directory like a package from the registry instead of creating a link, you would need to use [`npm pack`](/commands/npm-pack) while in the `<folder>` directory, and then install the resulting tarball instead of the `<folder>` using `npm install <tarball file>`
88+
89+
Example:
90+
91+
```bash
92+
npm install ../../other-package
93+
npm install ./sub-package
94+
```
8695

8796
* `npm install <tarball file>`:
8897

0 commit comments

Comments
 (0)