Using --prefix worked for me:
npm --prefix /path/to/project run build
Where path/to/project is the directory where your package.json with build command defined.
Using --prefix worked for me:
npm --prefix /path/to/project run build
Where path/to/project is the directory where your package.json with build command defined.