0

I want to run npm install in my folder and subfolder without having to run:

  1. npm install
  2. cd subfolder
  3. npm install

So, in this script I would run two npm install in one single command in my main folder without having to cd into the subfolder. I know theres how to do it by placing a script on package.json but I forgot the script now.

Rodrigo
  • 11
  • 2

2 Answers2

1

Problem solved, I could run all of the three commands using &&:

"scripts": {
    "yourscript": "npm install && cd subfolder && npm install"
}
Rodrigo
  • 11
  • 2
  • Glad you find a solution. Might be relevant to read: https://stackoverflow.com/questions/33014050/how-to-do-recursive-installation-of-dependencies-in-nodejs – DeveloperRyan Nov 23 '22 at 04:43
0

You can set a variable name like this

scripts: {
 {
 "cmdthatyouwant": "nmp i; cd folder; npm i"
 }
}