Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install other package.json dependencies

Simple question : Is it possible, in a package.json, to reference another package.json, and install its dependencies ? Thank you.

like image 215
Pythorogus Avatar asked Oct 20 '25 22:10

Pythorogus


1 Answers

Yes, this is possible, and this is automatically done by npm install.

If you have pkg-a that depends on pkg-b, including pkg-a in your dependencies will install both pkg-a and pkg-b when running npm install. That is because dependencies are actually references to the package.json of other packages. NPM, upon running install, builds a dependency tree of all the packages that are indirectly required by your current project, and installs all of them in the node_modules directory, and keeps track of them all in package-lock.json.

like image 177
Nino Filiu Avatar answered Oct 24 '25 09:10

Nino Filiu