Solving ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE Error
Posted January 18, 2024
PNPM manager shows some errors when working with workspaces. Such errors include ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE.
This post discusses some possible solutions to the ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE error.
What Causes ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE Error
This error means Pnpm publish doesn’t work correctly with workspaces.
Also, when installing packages in your monorepo, PNPM will show ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE error packages that have been published to npm. If you are missing some dependencies in your package.json
file, there is a hood this error will occur.
Also, the pnpm version might cause it.
Solving ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE Error
To solve your error:
Solution 1: Check for Updates
Update packages using the PNPM package manager:
pnpm -r update
pnpm -r update
is well covered in Pnpm Error Codes Docs
Updgade your installed PNPM and Node.js version. You can download and install Node.js and use the following command to Updgade PNPM:
where pnpm
# /usr/local/bin/pnpm
rm -rf /usr/local/bin/pnpm
curl -fsSL https://get.pnpm.io/install.sh | sh -
Solution 2: Working with Typescript
Make sure you publish your package from dist
. This way, make sure you update .npmrc
:
save-workspace-protocol=true
Finally, change local versions from rolling to true type. Check this documentation for more without rolling to true. You will need the node_modules
folder in your dist
package.
Solution 3: Trying to install the workspace From the project directory
If you are running the pnpm install
command to install the workspace From the project directory, Make sure you are in a workspace context.
If it is the pnpm install
command leading to ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE:
- Retrieve the workspace context by moving to the workspace directory
## Use a command that fits your project
cd ../..
- The run recursive argument with PNPM:
pnpm install-recursive
Solution 4: Review PNPM Logs:
If the above solutions don’t solve your ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE error, check PNPM logs for detailed error messages.
Wrapping Up
This post provided some insights into your ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE errors.