:: krowemoh

Friday | 27 DEC 2024
Posts Links Other About Now

previous
next

pnpm Error - Unsupported Environment

2023-04-16

I have a strange issue with copying around node projects while using pnpm.

When I copy the folder and then run pnpm install to rebuild the node_modules folder, I get the following error:

bash-4.2$ pnpm install
Lockfile is up to date, resolution step is skipped
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your Node version is incompatible with "/@sveltejs/kit/1.15.5_svelte@3.58.0+vite@4.2.1".

Expected version: ^16.14 || >=18
Got: v14.19.2

This is happening because the package's manifest has an engines.node field specified.
To fix this issue, install the required Node version.

The solution is to remove the pnpm-lock.yaml file.

rm pnpm-lock.yaml

I'm not sure why but it resolves the issue well enough for now.