3

I am learning to publish a demo application to npm. My package "abc" has a dependency of typeorm and another demo package "pqr" which is also using typeorm as a dependency.

I want to install "abc" in a "nodejs_web_app" and I want "pqr" to be automatically installed with it as it is a dependency. Now when I install "abc" it installs the entire set of "abc/node_modules" inside "nodejs_web_app/node_modules" and so with that, I get duplicate modules of "typeorm" too.

What is the right way to publish an application on npm in such a way that both "abc" and "pqr" dependencies get installed separately and the duplicates in the "nodejs_web_app/node_modules" only. I am guessing there should be some changes made in "package.json" just don't know what or there is any another way.

Any help or links to helpful tutorials sites would be appreciated.

0 Answers0