To install npm packages associated with a package.json file in the current working directory, the command npm install is typically used. However, I’m interested in whether there’s a way to install packages in a specific directory without having to change to that directory first. I’ve found workable solutions for tools like Bower and Gulp, which are as follows:
bower install --config.cwd= gulp build --cwd but haven’t discovered a similar feature for npm. When I attempt to run the command npm install --prefix C:\Users\ng\Projects\Lottery\src\SPA, it results in the following error:npm ERR! addLocal Could not install C:\Users\ng\Projects npm ERR! Windows_NT 10.0.10586 npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install” “–prefix” “C:\Users\ng\Projects\Lottery\src\SPA” npm ERR! node v6.2.1 npm ERR! npm v3.9.3 npm ERR! code EISDIR npm ERR! errno -4068 npm ERR! syscall read npm ERR! eisdir EISDIR: illegal operation on a directory, read npm ERR! eisdir This is most likely not a problem with npm itself npm ERR! eisdir and is related to npm not being able to find a package.json in a package you are trying to install. npm ERR! Please include the following file with any support request: npm ERR! C:\Users\ng\Projects\npm-debug.log Indeed, as per the the default prefix configuration typically points to the directory where Node.js is installed, commonly found at /usr/local or the specific location of node.exe on Windows.documentation,