From 20c83fae76ff4a051e4f6542a328f1c00cf071bb Mon Sep 17 00:00:00 2001 From: Wassim Chegham <1699357+manekinekko@users.noreply.github.com> Date: Wed, 16 Feb 2022 23:53:50 +0100 Subject: [PATCH] docs: update docs for npm install (#4428) npm install doesn't install dependencies if is outside of root project. Fixes #3358 --- docs/content/commands/npm-install.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/content/commands/npm-install.md b/docs/content/commands/npm-install.md index 83b9af1e4d07f..b4f8da8373d05 100644 --- a/docs/content/commands/npm-install.md +++ b/docs/content/commands/npm-install.md @@ -78,11 +78,20 @@ into a tarball (b). * `npm install `: - Install the package in the directory as a symlink in the current - project. Its dependencies will be installed before it's linked. If - `` sits inside the root of your project, its dependencies may + If `` sits inside the root of your project, its dependencies will be installed and may be hoisted to the top-level `node_modules` as they would for other - types of dependencies. + types of dependencies. If `` sits outside the root of your project, + *npm will not install the package dependencies* in the directory ``, + but it will create a symlink to ``. + + > 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 `` directory, and then install the resulting tarball instead of the `` using `npm install ` + + Example: + + ```bash + npm install ../../other-package + npm install ./sub-package + ``` * `npm install `: