Lenni
Lenni3w ago

Install Deno globally for all users on a Windows 11 machine

I'm setting up a PC for multiple users and would like to have Deno available to them. I've tried several ways of installing it so far, and it always was just available for my local admin user that I used to install it. I started from a fresh Win11 install. I tried: - Install from the admin account with NPM - Install from the admin account with Winget (using --scope machine) - Install from the admin account with the Deno install script - Install from a user account with NPM For some methods it would just say "access denied", for others it wouldn't even recognise the command when I ran deno from the user account. Any ideas how I can install it machine-wide?
1 Reply
Lenni
LenniOP2w ago
I did it this way now in my Batch script. Not the prettiest solution, but it works.
set "newNpmPrefix=C:\npm"
powershell -command "[System.Environment]::SetEnvironmentVariable('Path', $env:Path + ';%newNpmPrefix%', [System.EnvironmentVariableTarget]::Machine)"

winget install OpenJS.NodeJS.LTS --silent --disable-interactivity --scope machine --architecture x64 --accept-source-agreements --accept-package-agreements

powershell -command "$env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine'); npm i -g deno --prefix %newNpmPrefix%"
set "newNpmPrefix=C:\npm"
powershell -command "[System.Environment]::SetEnvironmentVariable('Path', $env:Path + ';%newNpmPrefix%', [System.EnvironmentVariableTarget]::Machine)"

winget install OpenJS.NodeJS.LTS --silent --disable-interactivity --scope machine --architecture x64 --accept-source-agreements --accept-package-agreements

powershell -command "$env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine'); npm i -g deno --prefix %newNpmPrefix%"

Did you find this page helpful?