npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Post install devDependencies are wiped out by install and link

Here’s the issue I’m having:

Say for example; package foo has the dependency bar. bar has a post-install script that installs all of its dev dependencies.

So I run npm i in foo which installs bar which triggers the post-install script.

But, I also need to run npm link on foo. npm link wipes out all of bar's dev dependencies which requires me to manually cd into node_modules/bar and run npm i --only=dev. I understand that this is a feature of npm to remove any extraneous packages, I’m just trying to figure out what my best option is so npm link doesn’t remove those dev dependencies.

I’d also like to mention that bar is a package I can make modifications to.


A simple work-around for local situation could be shifting the bar packages from devDependencies to dependencies, since they are being installed anyway?