npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Use package.json in root/parent folder

Hi,

I remember reading somewhere (an issue on the repo? here in the forum? :thinking:) that npm has some logic to retrieve and use the package.json in the topmost directory (if I run the installation from a sub-directory).

So, if I recall correctly, having something like

www/
 |- vendor/
 |  |- node_modules/
 |  |  |- libFoo/
 |  |     |_package.json
 |  |_package.json
 |_package.json

will use the package.json in the www directory for the npm install.

Where can I find the documentation of this behaviour?


Hi @Pictor13,
I found this information here, under the second paragraph of the More Information header.