Hello @kartik,
If you want to run a single command to install npm packages in nested subfolders, you can run a script vianpmand mainpackage.jsonin your root directory. The script will visit every subdirectory and runnpm install.
Below is a.jsscript that will achieve the desired result:
var fs = require('fs')var resolve = require('path').resolvevar join = require('path').joinvar cp = require('child_process')var os = require('os')// get library pathvar lib = resolve(__dirname, '../lib/')fs.readdirSync(lib) .forEach(function (mod) { var modPath = join(lib, mod)// ensure path has package.jsonif (!fs.existsSync(join(modPath, 'package.json'))) return// npm binary based on OSvar npmCmd = os.platform().startsWith('win') ? 'npm.cmd' : 'npm'// install foldercp.spawn(npmCmd, ['i'], { env: process.env, cwd: modPath, stdio: 'inherit' })})
Note that this is an example taken from aStrongLooparticle that specifically addresses a modularnode.jsproject structure (including nested components andpackage.jsonfiles).
Hope it helps!!
Thank You!!