volta icon indicating copy to clipboard operation
volta copied to clipboard

Could not read contents from directory ~/.volta/tools/image/pnpm

Open Dmitry-N-Medvedev opened this issue 2 years ago • 9 comments

after upgrading to 1.1.1 the following error occurs:

Could not read contents from directory ~/.volta/tools/image/pnpm

Dmitry-N-Medvedev avatar Jan 25 '23 10:01 Dmitry-N-Medvedev

Temporary solution: create directory ~/.volta/tools/image/pnpm

SuperHuangXu avatar Jan 30 '23 01:01 SuperHuangXu

Hi @Dmitry-N-Medvedev, thanks for reporting that! Can you share which command you were running when that error was shown? Also, do you have the experimental pnpm support enabled via VOLTA_FEATURE_PNPM?

charlespierce avatar Jan 30 '23 22:01 charlespierce

Same problem when volta list all, no VOLTA_FEATURE_PNPM

AngelMsger avatar Feb 02 '23 05:02 AngelMsger

Well, there is something wrong. I installed volta via homebrew, and it update to 1.1.1 recently. However, the symbolic links under $VOLTA_HOME/bin still point to /opt/homebrew/Cellar/volta/1.1.0/bin/volta-shim. May this information help you to find the bugs.

AngelMsger avatar Feb 02 '23 05:02 AngelMsger

Hi @Dmitry-N-Medvedev, thanks for reporting that! Can you share which command you were running when that error was shown? Also, do you have the experimental pnpm support enabled via VOLTA_FEATURE_PNPM?

hi, sorry for the late reply.

as @AngelMsger has mentioned, the error is here with any command if the VOLTA_FEATURE_PNPM flag is enabled. I had to disable this flag to get rid of the error.

Also, I prefer to update pnpm regularly ( almost daily ), but volta uses some predefined version of it regardless.

best regards, Dmitry

Dmitry-N-Medvedev avatar Feb 02 '23 08:02 Dmitry-N-Medvedev

@Dmitry-N-Medvedev Sorry but you said with any command rather than volta list all @AngelMsger said. I can reproduce the issue when using volta list all while the pnpm image directory is not created. The same issue will occur when the yarn image directory is not created. I've tested with the command volta list yarn in v1.1.0 and a similar Could not read contents from directory ~/.volta/tools/image/yarn printed out when no yarn image was fetched. Hence I believe there is a UX issue with the volta list <option> command but I need you to confirm if other commands do print the error. Thanks.

To solve this, simply fetch a pnpm image with volta fetch pnpm and the pnpm image directory will be created automatically.

chawyehsu avatar Feb 07 '23 15:02 chawyehsu

I had (probably) the same problem, and also maybe another problem, and found a workaround on Windows. Though it would still be nice if the workaround wasn't needed.

I used scoop to install volta at v1.0.8 and later to update to the latest version (v1.1.1). Then the problem happened:

The Problem

After the update, I ran into this problem

PS C:\Users\HP> volta list all
error: Could not read contents from directory C:\Users\HP\scoop\apps\volta\current\appdata\tools\image\pnpm

Please ensure you have correct permissions to the Volta directory.
Error details written to C:\Users\HP\scoop\apps\volta\current\appdata\log\volta-error-2023-03-09_10_40_10.507.log

Which error log file said

"C:\\Users\\HP\\scoop\\apps\\volta\\current\\appdata\\bin\\volta.exe" "list" "all"
Volta v1.1.1

Could not read contents from directory C:\Users\HP\scoop\apps\volta\current\appdata\tools\image\pnpm

Please ensure you have correct permissions to the Volta directory.

Error cause: The system cannot find the path specified. (os error 3)

Also, I had this problem

PS C:\Users\HP> volta install typescript
error: Could not create shared environment for package 'typescript'

Please ensure you have correct permissions to the Volta directory.
Error details written to C:\Users\HP\scoop\apps\volta\current\appdata\log\volta-error-2023-03-09_14_32_44.890.log

And that log file said

"C:\\Users\\HP\\scoop\\apps\\volta\\current\\appdata\\bin\\volta.exe" "install" "typescript"
Volta v1.1.1

Could not create shared environment for package 'typescript'

Please ensure you have correct permissions to the Volta directory.

Error cause: A required privilege is not held by the client. (os error 1314)

The Workaround

Uninstalling and reinstalling volta with scoop the regular way didn't solve the problem, because running scoop uninstall volta didn't get rid of all the node versions and npm packages i had previously installed via volta. Running scoop uninstall volta --purge, however, does get rid of that stuff. So here is how to fix it:

  1. Remember what things you installed with volta a. Here's how you can do that: Run volta list --format plain and copy the output of that command into a text file, for reference later. (Note: if there is a package.json in the directory that you run that command in, or even if the package.json is in a parent directory, then the output of running that command may be skewed in an undesirable way (if there is a "volta" property defined in that package.json))
  2. Run scoop uninstall volta --purge
  3. Run scoop install volta
  4. Look at that text file you made on Step 1 and run something like volta install [email protected] for each line of that text file.

That solves it, but it still would be nice if someone just changed volta so it didn't have that problem.

davidbludlow avatar Mar 09 '23 23:03 davidbludlow

Only bother to read this message if you are having a hard time reproducing the problem.

I started up a virtual machine with a mostly clean install of Windows 11 Pro 64-bit (not with Windows Sandbox). I installed scoop. Then I ran some commands that I copied into console-showing-steps-to-reproduce.txt along with the output of running those commands. Sorry that it looks messy, because the commands I typed are a little lost amongst the output of those commands, but I tried to make it a bit easier to read. Anyways, I will be surprised if that doesn't show you how to reproduce the problem on Windows.

davidbludlow avatar Mar 09 '23 23:03 davidbludlow

在Windows里面使用管理员打开命令行操作,就ok

macro0000 avatar Apr 07 '24 06:04 macro0000