Daniel Kobe Daniel Kobe - 9 days ago 6
Javascript Question

Why does the npm package I created have a node_modules folder in it when installing it as dependency for another module?

I just published my first npm package. When I install the package as dependency in my project, I open the project folder in node_modules and see that it also has a node_modules folder with one package,

history
in the folder. I don't have any regular dependencies for my project, only devDependencies so I don't understand why this is happening? You can see my package.json file and try installing the module from the github page here https://github.com/danielyaa5/react-contextulize

Answer

Running npm install will install devDependencies under many circumstances.

Try explicitly installing in production mode:

npm install --only=production

Here is a related answer with more info.

Comments