I have two separate projects that use npm - so I have both : some_base_folder/projectA/package.json and some_base_folder/projectB/package.json
some_base_folder/projectA/package.json
some_base_folder/projectB/package.json
You should use --prefix.
npm run [command] --prefix path/to/your/other/folder
And for yarn:
yarn --cwd path/to/your/other/folder [command]