Home > Software engineering >  Script in package.json to run more than one npm install?
Script in package.json to run more than one npm install?

Time:11-20

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.

CodePudding user response:

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

"scripts": {
    "yourscript": "npm install && cd subfolder && npm install"
}

CodePudding user response:

You can set a variable name like this

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