If anyone finds a better way, sound off in the comments below. npms built-in configuration file (/path/to/npm/npmrc) See npmrc for more details. $errors = powershell.exe -Command "cd `"c:\path\to\dest" `n npm install" so npm config -global set prefix C:ProgramDatanodejs npm config -global set cache. The output is sent to the host shell, and the errors are returned as a result variable. npm install -g -production windows-build-tools. The easiest path to that is calling powershell.exe -Command. The option I’ve settled upon is calling an external process and getting all the output for the external process in the current window. bin folder as expected, however, the node_modules folder you want will be c:\path\to\dest2\node_modules\\node_modules\.bin, so you would need run this command setting the prefix to a tmp folder then copy the folder to the correct location, at the cost of extra IO. npm install -cwd "c:\path\to\dest" -prefix "c:\path\to\dest2" Default: If the XDGDATAHOME env variable is set, then XDGDATAHOME/pnpm/store On Windows: /AppData/Local/pnpm/. If you change the target directory for the -prefix flag, it creates a nested hierarchy. So it acts as if you’re doing an install to the global NPM folder. npm config set prefix /.npm-global Open or create a /.profile file and add this line: export PATH/. The dependencies install, but the bin links, like bash scripts and cmd files, are stored in the c:\path\to\dest instead of c:\path\to\dest\node_modules\.bin which one would expect for a local install. I’ve seen posts talking using -prefix to accomplish this, however, if I do the following on Windows: npm install -cwd "c:\path\to\dest" -prefix "c:\path\to\dest" It just feels hacky to change the directory away from root working directory for a build. My primary objective for running NPM from a different folder is the use case of using build scripts. I find that trying to run NPM install for all dependencies in a different folder than where the package.json resides,… a bit troublesome.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |