Is there a manual install of node.js for Windows 7

2019-06-08 13:15发布

问题:

I have easily installed Node.js before on Macs and other PCs, but the PC I have now at work restricts the running of .msi files.

Is there a way to manually install and configure node.js and npm on Windows 7? I have access to Powershell.

回答1:

Installing nodejs (and npm) on a Windows 7 machine does not require any "magic" if you have Admin access on the target machine and do not care about setting up the expected "uninstall", various Windows performance counters, event tracing or Start menu entries.

To manually install from an existing installation on one machine to another machine, simply

  1. Copy the entire contents of your "\Program Files\nodejs" and "\Users\USERNAME\AppData\Roaming\npm" directories as well as the "\Users\USERNAME\.npmrc" file to the same directories on target machine. (Replace USERNAME with your own Windows login name.)

  2. Edit the "\Users\USERNAME\.npmrc" file to replace the source username with the username on the target machine.

  3. Add "C:\Program Files\nodejs" and "C:\Users\USERNAME\AppData\Roaming\npm" to your PATH.

If you'd like to manually install direct from the MSI (without an existing installation to work from), get Scott Willeke's excellent lessmsi program, which allows you to extract all the files from any msi archive and discover all the actions taken by the Windows Installer, such as required edits to the Register, etc. (Though for nodejs, you'll only need to edit the Registry to add the proper keys to uninstall it automagically.)