Reputation: 10067
I have a project which contains 2 subprojects:
And both of these projects have their own dependencies mapped in their own packages.json
files, which is placed in each subdir.
So the question is how to run npm install
from sub directories on heroku?
I tried putting something like this in the main npm file
"scripts": {
"postinstall": "cd my_subdir; npm install"
}
But it doesn't work, showing can't cd to my_subdir
Upvotes: 13
Views: 2408
Reputation: 1649
Utilize npm's --prefix
option:
"scripts": {
"postinstall": "npm install --prefix ./my_subdir"
}
Upvotes: 6