opensas
opensas

Reputation: 63625

volta: cannot install pnpm

I'm working on a SvelteKit project and I'm managing node and pnpm version with volta

this is my package.json

[...]
    "type": "module",
    "packageManager": "[email protected]",
    "engines": {
        "pnpm": "^9.1",
        "node": "^18.15"
    },
    "volta": {
        "node": "18.18.2"
    },
[...]

I installed volta, the when I ran node --version volta install node 18.18.2, but when I ran volta install pnpm it asked for a global node, and it install node 20.15.1

# start clean
$ rm -fr ~/.volta/

$ curl https://get.volta.sh | bash
  Installing latest version of Volta (1.1.1)
    Checking for existing Volta installation
    Fetching archive for Linux, version 1.1.1
######################################################################## 100.0%
    Creating directory layout
  Extracting Volta binaries and launchers
    Finished installation. Updating user profile settings.
Updating your Volta directory. This may take a few moments...
success: Setup complete. Open a new terminal to start using Volta!


$ node --version
v18.18.2


$ volta install pnpm
error: Node is not available.

To run any Node command, first set a default version using `volta install node`


$ volta install node
success: installed and set [email protected] (with [email protected]) as default
   note: you are using [email protected] in the current project


$ volta install pnpm
success: installed [email protected] with executables: pnpm, pnpx
sas@xps ~/devel/apps/wingback/billing (main)

$ pnpm --version
Volta error: Could not locate executable `pnpm` in your project.

Please ensure that all project dependencies are installed with `npm install` or `yarn install`

nevertheless the shim to pnpm is present in ~/.volta/bin

$ ll ~/.volta/bin/
total 34248
drwxrwxr-x 2 sas sas     4096 Jul 12 03:12 ./
drwxrwxr-x 7 sas sas     4096 Jul 12 03:11 ../
lrwxrwxrwx 1 sas sas       31 Jul 12 03:11 node -> /home/sas/.volta/bin/volta-shim*
lrwxrwxrwx 1 sas sas       31 Jul 12 03:11 npm -> /home/sas/.volta/bin/volta-shim*
lrwxrwxrwx 1 sas sas       31 Jul 12 03:11 npx -> /home/sas/.volta/bin/volta-shim*
lrwxrwxrwx 1 sas sas       31 Jul 12 03:11 pnpm -> /home/sas/.volta/bin/volta-shim*
lrwxrwxrwx 1 sas sas       31 Jul 12 03:12 pnpx -> /home/sas/.volta/bin/volta-shim*
-rwxr-xr-x 1 sas sas 13299508 Jan 24  2023 volta*
-rwxr-xr-x 1 sas sas  9577448 Jan 24  2023 volta-migrate*
-rwxr-xr-x 1 sas sas 12167481 Jan 24  2023 volta-shim*
lrwxrwxrwx 1 sas sas       31 Jul 12 03:11 yarn -> /home/sas/.volta/bin/volta-shim*

I'd like to work with the node version and pnpm version specified on packge.json, and to have pnpm use node 18.18.2

how can I achieve such a thing?

Upvotes: 0

Views: 562

Answers (0)

Related Questions