volta icon indicating copy to clipboard operation
volta copied to clipboard

npm global installation fails on Windows

Open s-KaiNet opened this issue 4 years ago • 8 comments
trafficstars

I use node@12 and built-in npm. I'm trying to install the Yeoman generator:

npm install @microsoft/generator-sharepoint -g

At the last step I see an error Volta error: Could not create environment, logs:

"npm" "install" "@microsoft/generator-sharepoint" "-g" Volta v1.0.2 Could not create environment for @microsoft/generator-sharepoint v1.12.0 at C:\Users\admin\AppData\Local\Volta\tools\image\packages@microsoft/generator-sharepoint Please ensure you have correct permissions to the Volta directory. Error cause: Access is denied. (os error 5)

And also below events from proc monitor:

image

When I run npm install generator-code -g to install another generator, it works well. I don't have antivirus and even Windows Defender is switched off since that's a developer VM.
It looks like the issue only appears with huge generators with lots of files (like @microsoft/generator-sharepoint)

s-KaiNet avatar Mar 24 '21 14:03 s-KaiNet

Hi @s-KaiNet, that's a strange one. The fact that the error is actually "Access is denied" makes me curious if there's some other process that's somehow affecting the ability to move the files. What's also strange is we have retry behavior baked in for that operation, so if it fails it should retry for up to 30 seconds.

charlespierce avatar Mar 24 '21 23:03 charlespierce

I'm having the same issue trying to upgrade npx:

Volta error: Could not create environment for npx v10.2.2
at C:\Users\Cobra\AppData\Local\Volta\tools\image\packages\npx

Please ensure you have correct permissions to the Volta directory.
Error details written to C:\Users\Cobra\AppData\Local\Volta\log\volta-error-2021-07-16_19_40_41.806.log

cobrabr avatar Jul 16 '21 23:07 cobrabr

I'm having the same issue trying to upgrade npx:

Volta error: Could not create environment for npx v10.2.2
at C:\Users\Cobra\AppData\Local\Volta\tools\image\packages\npx

Please ensure you have correct permissions to the Volta directory.
Error details written to C:\Users\Cobra\AppData\Local\Volta\log\volta-error-2021-07-16_19_40_41.806.log

I'm getting same error with npx, did you manage to fix the problem ?

imadhy avatar Nov 16 '21 11:11 imadhy

@imadhy The only way I made it install properly was by running Volta from an administrator console, and even then, only for a few tools. npx simply doesn't work.

cobrabr avatar Dec 03 '21 22:12 cobrabr

I'm still getting this error in 2022 Both npm i -g and volta install fails. image

jonybekov avatar Feb 14 '22 15:02 jonybekov

in npm 7+, npx is built in, and the separate npx package shouldn’t be used.

ljharb avatar Feb 14 '22 16:02 ljharb

Looks like Volta doesn't work on non admin profiles in Windows.

ak274 avatar May 05 '22 09:05 ak274

Same issue on my env, but it was fixed by enabling Developer mode. https://docs.volta.sh/guide/getting-started#windows-installation image

horihiro avatar Jun 29 '22 23:06 horihiro

I made a test and it looks like the use of symlinks are unnecessary. I ran npm install -g rimraf and replaced the %localappdata%\Volta\bin\rimraf.exe symlink by a renamed copy of volta-shim.exe and it worked!

Am I missing something or Volta could run totally without the need of symlinks on Windows? If yes, it would be a huge security enhancement, as Developer Mode enable much more the symlinks and Microsoft discourages the use of symlinks. For example, in my company is very difficult for someone have admin rights or have Developer Mode enabled for security reasons.

rcsilva83 avatar Dec 05 '22 17:12 rcsilva83