Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using nvm with blocked VBScript engine #383

Open
AllainPL opened this issue Aug 23, 2018 · 8 comments
Open

using nvm with blocked VBScript engine #383

AllainPL opened this issue Aug 23, 2018 · 8 comments

Comments

@AllainPL
Copy link

Hi, i have a question. I have a computer that has blocked VBScript engine by domain policy. Is it possible to run nvm? Because even with elevated command prompt(or PS) i stil get the info about the missing script engine. Is there a workaround to use nvm without it?

@coreybutler
Copy link
Owner

Unfortunately, there's no way to do this. The VBScript runs the elevation command, which is required to symlink node into the file system.

I would be open to PR's if someone has an alternative. The ideal situation would be to embed this into the Go app, but I haven't had enough time to explore this.

@chawyehsu
Copy link

I have a fork that totally remove the whole elevated permission part, use junctions for symlink. As a restricted user, this works fine for me. You could try my build to see if that help, but there is only noinstall build.

And FYI, actually, there is an old issue tracking about NTFS junctions here.

@AllainPL
Copy link
Author

@h404bi Thanks for the code! I get a Exit Code 5: Access Denied - however when running in elevated cmd - it works(the vba is not used anymore).

@coreybutler do you have any opinion what direction you will be going, considering #79?

@chawyehsu
Copy link

chawyehsu commented Aug 25, 2018

@AllainPL
If you have something that located in C:\Program Files/C:\Program Files\nodejs or other path which needs elevated permission, it will still need a elevated cmd.

settings.txt

root: C:\Users\<omitted>\path\to\nvm-windows\nodejs
arch: 64
proxy: none

I use nvm in user-space, which means all my nvm and node stuffs are stored in my %USERPROFILE%, no need to access C:\Program Files, so I could manage all my things with a normal restricted user, without vbscript, without UAC pop-up. I use it on my WIndows 7 SP1 and Windows 10 machines.

But this all means that I couldn't mange the system-wide installed nodejs, I think it's ok for me, I don't have system-wide installed nodejs , just use that one in my user-space, all things good.

@coreybutler
Copy link
Owner

@AllainPL - my leaning is towards making the symlink type configurable as a setting. However; this would most likely be a 2.X.X feature, so no immediate ETA. Once I release Fenix 3, I should have alot more time to focus on the next release.

@rbuckton
Copy link
Contributor

BTW: If the user has PowerShell installed, you can possibly avoid using VBScript for a UAC prompt using the following command line instead:

powershell -NoLogo Start -Verb:RunAs -Wait -FilePath:<executable> -ArgumentList:<args>

@rbuckton
Copy link
Contributor

rbuckton commented Nov 11, 2019

Also, if you install nvm-windows with the NodeJS path set to a user-local folder (such as %USERPROFILE%\AppData\Local\nodejs), you can switch to junctions and skip elevation by replacing the contents of %USERPROFILE%\AppData\Roaming\nvm\elevate.cmd with the following:

@setlocal
@echo off
set CMD=%*
REM Old 'elevate.cmd' commands...
REM set APP=%1
REM start wscript //nologo "%~dpn0.vbs" %*

REM New 'elevate.cmd' commands...
%CMD:mklink /D=mklink /J%

This executes the command without elevation, replacing mklink /D with mklink /J to create directory junctions instead.

@Jasonlhy
Copy link

Jasonlhy commented Sep 7, 2021

The way node version manager works is to create a symbolic link:

C:\Program Files\nodejs <========> C:\Users\[myuser]\AppData\Roaming\nvm\[version]

To set the symbolic link manually, you can run the following commands (with admin right):
And make sure you understand what is going on ...

cmd /C rmdir "C:\Program Files\nodejs"
cmd /C mklink /D "C:\Program Files\nodejs" "C:\Users\myuser\AppData\Roaming\nvm\v12.22.6"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants