volta
volta copied to clipboard
use zip to install volta ,node not works
i use zip to install volta because msi needs admin on windows. then i got cannot find command node. Please ensure that xxx/volta is available on your Path.
use msi to install will get below files, but if you use zip you will only get 3 files volta, volta-shim and volta-migrate
Once you unzip the files, you'll need to run volta.exe setup, which will then create the rest of the files for you and I believe should also update your path!
The function behaves different for Windows and Linux: https://github.com/volta-cli/volta/blob/a7384fa4fc7a0eca961032da4d962d94218b5868/crates/volta-core/src/shim.rs#L28
Hence, the shims are not created by volta.exe setup.
My workaround:
- Download the
.msi - Use 7-zip to unzip the msi
- Rename the unzipped files, e.g. from
voltaEXEtovolta.exeornpmCMDtonpm.cmd - Use the renamed files instead of the content from the zip
Hello everyone,
I just encountered the same problem today, trying to install volta without Admin rights just seems impossible because of the missing shims when simply unpacking and setting up with volta setup.
To fix the problem, I think that when detecting a windows environment while doing volta setup, a check to verify that the shims are present in the volta.exe folder should be performed.
If the shim files are missing, they are then created along the volta.exe, just like the installer does.
I have confirmed that if you place such a script in the ZIP file extraction destination and run it, you will get the same results as if you installed it using the installer.
https://gist.github.com/got4416/2d2ef93151a4a358900401ef44ea8e4c#file-volta-shim-setup-cmd
@echo off
pushd "%~dp0"
set VOLTA_SHIM_EXE=volta-shim.exe
set SHIM_BINARY=node,npm,npx,pnpm,yarn,yarnpkg
set SHIM_SCRIPT=npm,npx,pnpm,yarn,yarnpkg
if not exist %VOLTA_SHIM_EXE% (
echo ERROR %VOLTA_SHIM_EXE% not found!
echo.
pause
exit /b 1
)
for %%s in (%SHIM_BINARY%) do (
echo create %%s.exe
copy /y %VOLTA_SHIM_EXE% %%s.exe
)
for %%s in (%SHIM_SCRIPT%) do (
echo create %%s.cmd
(
echo @echo off
echo ^"^%%^~dpn0.exe^" ^%%^*
)>%%s.cmd
)
popd
exit /b
I have confirmed that if you place such a script in the ZIP file extraction destination and run it, you will get the same results as if you installed it using the installer.
https://gist.github.com/got4416/2d2ef93151a4a358900401ef44ea8e4c#file-volta-shim-setup-cmd
@echo off pushd "%~dp0" set VOLTA_SHIM_EXE=volta-shim.exe set SHIM_BINARY=node,npm,npx,pnpm,yarn,yarnpkg set SHIM_SCRIPT=npm,npx,pnpm,yarn,yarnpkg if not exist %VOLTA_SHIM_EXE% ( echo ERROR %VOLTA_SHIM_EXE% not found! echo. pause exit /b 1 ) for %%s in (%SHIM_BINARY%) do ( echo create %%s.exe copy /y %VOLTA_SHIM_EXE% %%s.exe ) for %%s in (%SHIM_SCRIPT%) do ( echo create %%s.cmd ( echo @echo off echo ^"^%%^~dpn0.exe^" ^%%^* )>%%s.cmd ) popd exit /b
works for me, thank you bro