Errors with pnpm

If you use pnpm as a package manager in your Medusa application, you might face errors about missing packages. For example:

Terminal
can't resolve @medusajs/dashboard

You may also receive an error related to Tanstack Query:

Terminal
No QueryClient set, use QueryClientProvider to set one

Why This Error Occurred#

Medusa doesn't officially support pnpm as a package manager, which may lead to unexpected errors, including issues with package resolution.

For Tanstack Query, the error occurs because the package is required by @medusajs/dashboard, but pnpm does not automatically install it as a dependency of that package.


How to Fix it#

To resolve this error and other potential errors, consider switching to yarn as your package manager.

If you still want to use pnpm, you must manually install the following packages in your project:

Terminal
pnpm add @medusajs/dashboard @medusajs/icons @medusajs/types @medusajs/draft-order @medusajs/ui

Make sure to also update these packages whenever you update your Medusa application.

For the Tanstack Query error, you must also install it manually. It must be the same version installed in @medusajs/dashboard:

Terminal
pnpm add @tanstack/react-query@{version}
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break