Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nam_co's avatar

npm install package.json destination path

Hi, I was wondering if theres a way to specify the destination folder of a package.json npm install, so it can publish in the public instead of node_modules, please I don't wat to use elixir/mix

Appreciate any help

0 likes
2 replies
willvincent's avatar

No. package.json dependencies are installed into node_modules, that's just the way it is.

You could always manually download the css or javascript and place it in your public directory.. or use your own script(s) to copy the relevant file(s) after they're install via npm/yarn (an npm script would work for that). Or you could use yeoman or bower, etc.

There are lots of ways to skin this cat, and nothing is forcing you to use npm/yarn.. if fact if you're not using webpack, gulp, elixir or another build tool there's really no reason you should be using the package.json and npm/yarn at all.

nam_co's avatar

Hi Will, thanks for the answer, I ended up moving the package.json to the public and did a npm install and it worked, I wish there was a way, like in bower, hopefully in the future, but thanks anyway

Please or to participate in this conversation.