Skip to content

Instantly share code, notes, and snippets.

@rajeshkumaravel
Last active May 8, 2024 12:41
Show Gist options
  • Save rajeshkumaravel/285625f028b5a909b545a53f53c38239 to your computer and use it in GitHub Desktop.
Save rajeshkumaravel/285625f028b5a909b545a53f53c38239 to your computer and use it in GitHub Desktop.
Installing NodeJS thru NVM in Windows (Without Admin)

************ UNINSTALL ANY PREVIOUS NVM AND NODEJS ************

1. Open Powershell and Execute following command

cd $Env:USERPROFILE;
Invoke-WebRequest https://raw.githubusercontent.com/jchip/nvm/v1.5.4/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;
del install.ps1

2. If you encounter following error

.\install.ps1 : File C:\Users\node\install.ps1 cannot be loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:3 char:1
+ .\install.ps1 -nvmhome $Env:USERPROFILE\nvm;
+ ~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

3. Execute following command to override #2 error

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
  • Provide answer as "Y"

    Execution Policy Change
    The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
    you to the security risks described in the about_Execution_Policies help topic at
    https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): 
    

4. Execute following command

cd $Env:USERPROFILE;
Invoke-WebRequest https://raw.githubusercontent.com/jchip/nvm/v1.5.4/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;
del install.ps1
  • NVM should be installed

    
    Got NVM_HOME C:\Users\node\nvm from command line
    Default NVM_LINK to C:\Users\node\nvm\nodejs\bin
    Retrieving https://nodejs.org/dist/v18.12.1/node-v18.12.1-win-x64.zip
    Retrieving https://registry.npmjs.org/@jchip/nvm/-/nvm-1.5.4.tgz
    Installing Node v18.12.1...
    Node.js v18.12.1 installed.
    The operation completed successfully.
    NVM installed, Node.js version v18.12.1 activated.
    

5. Execute to Verify NVM installation

nvm ls
  • Installed NVM

    PS C:\Users\node> nvm ls
    v12.22.12
    * v18.12.1 (linked)
    

Ref: https://github.com/jchip/nvm

@paprika135
Copy link

相当完美!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment