How to install nodeJS and npm on Windows
machines located in hardened corporate environments
Karthikeyan Govindaraj
Oct 7, 2018
As Intermediate IT professionals, we all feel the great pain and frustration of installing software like this, and
getting it to run, on a Windows workstation in a hardened corporate environment.
The reason for this is because the developers target their releases for noobs that just want to tinker with it awhile,
lose interest, and move on, so that the developers are not badgered constantly by basic questions. So, they develop
a setup program that accesses the registry, sets up paths, etc. so that even a chimp can just run the setup and both
node and npm will run out of the box, without errors, every time.
The problem with this when attempting to setup the software in a hardened corporate environment is that these
environments do not allow users or even power users to run executables with admin privileges. They also do not allow
users or even power users to access the Registry and to write data to system folders.
The vast majority of developers do not create portable packages for their software, again assuming that all users will
either be noobs that have to be hand-held, or experienced network administrators that either have admin privileges or
else will figure it out quickly by themselves. Intermediate developers are left out of the loop.
Some developers do provide portable packages, and in the case of nodejs , we are very lucky. Node
and especially npm are critical for enabling compiled web development and development with web frameworks,
such as React. However, not surprisingly, the version of npm that comes in the portable package does
not run out of the box, generating cryptic errors.
Below is a step-by-step set of instructions for getting npm to work.
-
Download the latest version of the portable
nodeJS zipfile, found
here, and unzip it to a folder of your choice.
- Add that folder to your user and system PATHs.
-
Make sure
node.exe works by entering: node.exe -v at a command prompt.
- Delete the
node_modules\npm folder in your node directory.
-
Determine what the latest version of
npm is. Ironically, it appears that the best way to do that is to
google the following exact phrase:
What is the current latest version of NPM?
...then look at the "People also ask" feature of Google, probably the most useless feature of the platform.
(believe it....or not)
-
Once you have the number of the latest version, download the
npm package by using the following URL:
https://registry.npmjs.org/npm/-/npm-{VERSION}.tgz
it is a tarred, gzipped file so you will need a utility such as 7-zip to get the contents out of it.
-
Rename the
package folder to npm , and place that folder inside the node_modules
folder you accessed earlier.
-
Issue the following command at a prompt, preferrably in the node folder:
node bin/npm-cli.js install npm -gf
-
After the command finishes, test if
npm works by issuing the following command:
npm -v
If it works, you're in business. If not....happy googling.....
|