fancy
fancy

Reputation: 51383

npm is install packages in ../../node_modules instead of /node_modules, why?

When I install locally is puts my modules two parents above my project folder. Why is this happening?

Thanks!

Upvotes: 1

Views: 195

Answers (2)

ccanduc
ccanduc

Reputation: 259

NPM install will look back in the directory to find a node_modules directory, if one is not present.

If you're just prototyping or working through a tutorial, npm installing something locally and having it save to another node_modules file will actually still 'work' - but obviously this isn't ideal.

I think a better solution here is actually to use npm init Documentation Here

This will set up a packages.json file which will track which versions and modules you are using for your node app and set up a node_modules file.

Upvotes: 0

fancy
fancy

Reputation: 51383

toss the node_modules folder in there manually and you're good

Upvotes: 2

Related Questions