How do you set the custom location for a local installation of package when using npm?

Asked 2 years ago

Hello, so I have a specific package that I'd like to install in a directory that isn't the default one (node_modules). What's the best way to handle this?

Kole Delacruz

Monday, October 03, 2022

Installing packages with npm outside of the default directory is not reccomended unless you know what you're doing. Still, you can do it by adding two flags "--prefix" and "--global". An example usage of this command would be "npm install packageName --global --prefix ./directory"





Write an answer...

Cancel

Please follow our  Community Guidelines

Can't find what you're looking for?