如何通过powershell在自定义目录中安装node.js?

如何通过powershell在自定义目录中安装node.js?,node.js,powershell,installation,Node.js,Powershell,Installation,我正在编写一个脚本,通过PowerShell在多台机器上安装NodeJS。 默认情况下,NodeJS安装在C:\Program Files\NodeJS文件夹中。我可以为安装定义自定义目录吗 我正在运行以下命令: msiexec.exe /i $nodejs_download_filename /L*V "logger.log" /passive | out-null 为了指定目标目录而不是默认目录,是否有任何参数要添加到此行?您可以参考此 You can move the node.exe

我正在编写一个脚本,通过PowerShell在多台机器上安装NodeJS。 默认情况下,NodeJS安装在C:\Program Files\NodeJS文件夹中。我可以为安装定义自定义目录吗

我正在运行以下命令:

msiexec.exe /i $nodejs_download_filename /L*V "logger.log" /passive | out-null
为了指定目标目录而不是默认目录,是否有任何参数要添加到此行?

您可以参考此

You can move the node.exe to the d drive. Then check your environment path. 
Type set in a command window or in computer properties. 
Make sure you have the folder that contains node.exe in your path. 
Running node in a command window will work from any folder then.

For installed npm packages, ie.. node_modules folder.. 
That just needs to be in a directory above where your writing your code, so try putting that folder in d:\ Assuming your going to be writing your apps on the d drive now.

In .npmrc file, change prefix setting to desired folder. Global packages get installed in node_modules under that folder.