103

I'm using Windows as a simple user (I don't have any admin rights) and want to install NodeJS LTS.

On the download site I have the choice to download only the binary node.exe (which don't includes npm) or the node.msi installer which requires the admin rights to execute.

How can I manually install node.exe and also be able to use npm?

Anthony O.
  • 22,041
  • 18
  • 107
  • 163

12 Answers12

166

UPDATE 10/2018

On Node's download page referenced in step 1. there is now a .zip archive download which contains both the nodejs executable and npm. Unpacking that to a suitable path and adding this path to your PATH environment variable (step 2.) will give you both node and npm (so you can skip steps 3. - 6.).

Let say you want to install it into %userprofile%\Applications\nodejs-lts, let's name it <NODE_PATH>.

  1. Download the LTS node.exe binary for Windows and copy it to <NODE_PATH>.

  2. Add <NODE_PATH> to your PATH environment variable (set PATH=<NODE_PATH>;%PATH% or using Windows user interface)

  3. Download the stable at https://registry.npmjs.org/npm/-/npm-{VERSION}.tgz npm package (following the documentation)

  4. Unzip the npm-{VERSION}.tgz anywhere (using 7zip for example)

  5. Launch a cmd and cd into the place where you have unzipped npm

  6. Execute: node cli.js install -gf or node bin/npm-cli.js install npm -gf on certain versions (thanks to this comment)

The last command is specified in the Makefile for target install, target which the README.md invites to execute when manually installing.

Ariel_HIAI
  • 23
  • 1
  • 4
Anthony O.
  • 22,041
  • 18
  • 107
  • 163
  • 1
    @Anthony What does step 6 do here? Thanks. – Kiran Pagar Jul 19 '16 at 18:04
  • 1
    @KiranPagar it is the command specified in the `Makefile` for target `install`, target which the `README.md` invites to execute when manually installing. – Anthony O. Jul 20 '16 at 09:41
  • 1
    I wonder how i'm supposed to add it to the PATH var if can't update it as i don't have admin rights ! – Hassam Abdelillah Nov 15 '16 at 10:00
  • 2
    @HassamAbdelillah yes you can, in your **user**'s `PATH` environment variable: http://superuser.com/a/133459/136024 – Anthony O. Nov 15 '16 at 10:45
  • I don't have such a variable on my user variable panel. Am i supposed to create a "PATH" variable with the same name as the "PATH" variable for the system ( which i can't modify) – Hassam Abdelillah Nov 15 '16 at 15:25
  • @HassamAbdelillah yes exactly. The values will be merged for your user. – Anthony O. Nov 15 '16 at 16:06
  • 4
    For me it was this the commant i had to use: `node bin/npm-cli.js install npm -gf` – xavipen Jun 20 '17 at 15:10
  • 1
    Thank you @xavipen, that worked for me, with only one thing more... in case someone else did not figure out... at first the error: `npm ERR! code EEXIST npm ERR! Refusing to delete C:\Users\...\node-v6\npm.cmd: is outside C:\Users\...\node-v6\node_modules\npm and not a link npm ERR! File exists: C:\Users\...\node-v6\npm.cmd npm ERR! Move it away, and try again.` Just do what it says... at the node directory, move the npm files (cmd / sh) from there and run again the command. – Ualter Jr. Oct 09 '17 at 09:56
  • btw. in some environment with strong acl, the logged in user has no execution right to set the path variable. then the installation will then fail – MattOpen Dec 01 '17 at 06:55
  • @MattOpen you mean, even in his/her own **user**'s `PATH`? I don't think there is such ACL, is there? – Anthony O. Dec 01 '17 at 08:54
  • @AnthonyO. If your PC is part of a domain then a system admin can define the ACL . more about this https://msdn.microsoft.com/de-de/library/windows/desktop/ms724878%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 – MattOpen Dec 01 '17 at 09:58
  • @MattOpen yes I know that but he can't forbid you to set your own **user**'s `PATH` (I'm not talking about the system's `PATH`, but the user's one) can he? – Anthony O. Dec 01 '17 at 10:19
  • 1
    @AnthonyO.can`t answer finally, but actually sitting at my client with strong acl and I was able to set user var only for the current cmd window. After closing this cmd window, my env variable were reset to default - I am not able to set user var permanently. cheers – MattOpen Dec 13 '17 at 17:11
  • @MattOpen you just have to open the "windows menu", right-click on "Computer" > properties the click on the "advanced settings" button, then on "Environment variables" then you should be able to modify / add environment variables in the top list "user variables for ". – Anthony O. Dec 13 '17 at 19:11
  • @AnthonyO.as I said before, "STRONG ACL" there is no menu at present, it is denied by admin rules. – MattOpen Dec 14 '17 at 10:41
  • Windows Defender Firewall on my computer prevents node from downloading dependencies from the npm registry. Can that be fixed somehow? (I do not have admin rights) – andy Sep 24 '20 at 09:33
  • ´set PATH=;%PATH%´ prepends path to the system path. But after restart it disappears. I there a way to keep it permanently without admin rights? – o-sapov Aug 01 '22 at 13:05
  • @o-sapov I think you will find the answer to this question [here](https://serverfault.com/a/548112/93281) – Anthony O. Aug 02 '22 at 10:29
  • When executing ```node bin/npm-cli.js install npm -gf``` im receiving the error: npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY npm ERR! request to https://registry.npmjs.org/npm failed, reason: unable to get local issuer certificate – Ruud van de Ven Feb 09 '23 at 08:57
  • @RuudvandeVen `request to registry.npmjs.org/npm failed` : it seems that you have some enterprise proxy or something that forbids downloading from registry.npmjs.org ? – Anthony O. Feb 09 '23 at 16:18
  • Thanks without this I couldn't have learnt about web development in my office laptop – Kavyajeet Bora Feb 27 '23 at 06:02
50

The nodejs version of 6.11 LTS and later seems to be easier to install, because npm is already included.

  1. Download the node.js LTS binary for Windows and extract it to your desired location
  2. Add the path of the nodejs folder to the PATH environment variable: (Shortcut winkey+R and enter: rundll32 sysdm.cpl,EditEnvironmentVariables)
  3. Open a new command window (winkey+R and type cmd)
  4. Type node -v and npm -v to verify the installation
joerno
  • 911
  • 2
  • 10
  • 19
  • 2
    Worked like a charm as of today with 8.9.4. Thanks! I would suggest to edit the point 3: "Open a new command window (CMD+R) and type cmd", otherwise it's confusing with point 4. – Gryzorz Jan 15 '18 at 07:31
  • 3
    On Windows 10 watch out for long paths when unzipping your node zip file: https://stackoverflow.com/questions/47431338/folder-path-too-long-issue-in-installing-node-js-based-service/50561485#50561485 – bownie May 28 '18 at 07:51
22

Just download the windows binary (NOT the msi installer) from here, unzip the file, then add the location of the node.exe file to system path. This means that after unzipping the downloaded binary, you get a folder, then you have to open that folder itself. That is the path you should add to system path.

To add to system path, do this, thanks to Abdel Raoof

Open Run with dialog (Win + R). Copy and paste this line in your command line

rundll32 sysdm.cpl,EditEnvironmentVariables.

In User variables for user_name (the top window) path of your environment variables dialog add the path to your unzipped node download. To check for successful installation

node -v

npm -v
chidimo
  • 2,684
  • 3
  • 32
  • 47
  • Glad to here that there's a comfortable solution now. Thanks. – hgoebl Oct 20 '17 at 14:30
  • This doesn't work, when i add the path and press OK and close the window, when i reopened it, it wasn't there. I tried adding the path many time but faced the same problem, any solutions?? – Aashish Kumar Dec 18 '18 at 09:17
  • I think its quite possible to download and install node.js indows binaries now. I actually downloaded and installed one recently from here – chidimo Dec 18 '18 at 12:29
  • I had the command line open and it took me a while to realize I had to restart it to confirm installation / use node. :) – Suki Dec 14 '22 at 06:54
14
  1. Download the node.js zip file from official page. https://nodejs.org/en/download/
  2. Unzip the file.
  3. Goto Edit Environment Variables For Your Account.
  4. Add new path /node-v10.14.2-win-x64\node-v10.14.2-win-x64
  5. That's it... now you have installed both node.js and npm.
  6. Use node -v and npm -v to check installation.
Bhargav
  • 385
  • 6
  • 10
8

Add following paths to the PATH environment variable, if you have downloaded the Node.js Windows Binary (.zip)

  1. <your os root>\node-v10.16.1-win-x64\
  2. <your os root>\node-v10.16.1-win-x64\node_modules\npm\bin\

Then test following commands from the command prompt:

node -v

npm -v
lawrence-witt
  • 8,094
  • 3
  • 13
  • 32
Rahamath
  • 491
  • 6
  • 4
5

The answer provided is too old now. Portable download for Node (including NPM) is available as a zip download and it word just out of the box. you just need to add the folder to the path.

RPS
  • 61
  • 1
  • 2
2

For node portable installation in windows batch file with below command can also be created in node root directory(where node.exe file resides) which updates PATH environment variable on execution and also directly through command prompt from node root directory

PATH %~dp0;%PATH%;

~dp0 : fetches current directory path in windows

Hopes that Helps

Imran
  • 2,906
  • 1
  • 19
  • 20
1

Source: https://medium.com/@github.gkarthiks/how-to-install-nodejs-and-npm-in-non-admin-access-windows-machines-102fd461b54c:


Step 1: Download the nodeJS.exe file from https://nodejs.org/en/download/ by clicking on All download options (example: https://nodejs.org/dist/v12.16.1/) and choose the right Windows architecture and download it.

Step 2: Choose a folder for nodeJS. For example, C:\ProgramData\Applications\nodejs and save the downloaded file under this folder.

Step 3: Add the nodeJS folder to the environment variable PATH by executing the below command in the cmd.exe, or using the User Interface. set PATH=C:\ProgramData\Applications\nodejs;%PATH% OBS! Remember to restart your computer after setting the environment variable. (Windows 10)

Step 4: Now download the stable version of npm from the below link by replacing the version. https://registry.npmjs.org/npm/-/npm-{VERSION}.tgz For example for npm version 6.4.1, https://registry.npmjs.org/npm/-/npm-6.4.1.tgz

Step 5: Now unzip the downloaded npm file anywhere and cd into package folder. (I used convert.io to convert tgz to zip for unzipping in Windows 10 https://convertio.co/tgz-converter/)

Step 6: Execute the following command in the cmd.exe

node bin/npm-cli.js install npm -gf

Step 7: Execute the following commands to verify the installation of nodeJS and npm.

node -v
npm -v
jeppoo1
  • 650
  • 1
  • 10
  • 23
0

Accepted answer from @Anothony O. didn't work for me. I got it working following these instructions and by adding the following to node\node_modules\npm\npmrc

strict-ssl=false
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Nebu
  • 1,352
  • 1
  • 14
  • 21
  • 1
    Did you have any error message in order to know why it didn't work for you? Thank you – Anthony O. Oct 07 '16 at 08:28
  • The link only works without the trailing slash: http://abdelraoof.com/blog/2014/11/11/install-nodejs-without-admin-rights – Michael McHenry Mar 20 '17 at 19:27
  • 1
    An easier and potentially more reliable way to change npm settings like that would be running the command `npm set strict-ssl false`. – ewall Mar 15 '18 at 20:19
  • This helps solve the error message when SSL validation fails "npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY ... request to https://registry.npmjs.org/... failed, reason: unable to get local issuer certificate" – ewall Mar 15 '18 at 20:21
0

As others have pointed out, npm is now included with the binary (.zip) node download. So installing node and npm without admin rights is straightforward, though you need to manually add the node directory to the PATH environment variable.

However, as of v8.11.4, the binary was including npm v5.6.1. Running npm install npm@latest -g complained about not being able to delete npm.cmd and npx.cmd. Moving those files out of the node directory fixes that, but then you can't simply run npm on the command line, because npm.cmd is no longer on the node path.

Trying @Anthony O's approach of downloading the latest npm .zip and installing from there didn't work either, as it was complaining about rimraf not being installed. It seemed like maybe the npm install script was assuming rimraf was installed globally.

What finally worked was changing to the node directory and specifying the full path to npm-cli.js from there:

node node_modules/npm/bin/npm-cli.js install -g npm@latest

I see that the node v8.12.0 package that was just released now includes npm v6.4.1, so the above shouldn't be necessary for now.

jdunning
  • 1,356
  • 1
  • 14
  • 26
0

Download the node js zip file, extract it to a folder. Then create a windows batch file to set path to node js folder(as you may not be able to set path the usual way witout admin rights). Then run your node/npm/npx commands from the same command window. You even can open Visual Studio Code from there. If you need step by step checkout this video : https://youtu.be/BLnbtsDIW_E

Don Srinath
  • 1,565
  • 1
  • 21
  • 32
-1

Try GitHub n-install:

curl -L https://git.io/n-install | bash -s -- -y
desertnaut
  • 57,590
  • 26
  • 140
  • 166
wayofthefuture
  • 8,339
  • 7
  • 36
  • 53
  • 2
    The question was specifically for Windows OS. This *might* work if you have the Linux Subsystem for Windows 10 or possibly with cygwin, but no typical Windows box would be able to grok that... – ewall Mar 15 '18 at 19:59