How to solve "Module 'X' has no exported member 'Y'" error, but in a pnpm monorepo?
Hi all,
I've come to a common issue where the types when exporting members isn't showing correctly (as seen in attached), and the usual
npm
solution does work (if I remove pnpm as the package manager).
However, the project setup I have is a pnpm monorepo, so that solution doesn't work unfortunately. Is there another workaround or do I have to change the whole project's package manager (cause pnpm is better than npm for monorepos)?![No description](https://cdn.answeroverflow.com/1196009759661371412/CleanShot_2024-01-14_at_11.29.28.png)
20 Replies
Hi @sgtpepperino. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error message "Module 'X' has no exported member 'Y'" typically occurs when using
pnpm
due to its cache system. Refine is aware of this issue and is actively working on resolving it by updating their peer dependencies with each version release. However, this is still a work in progress.
In the meantime, you can resolve this error by using the npm i <module-name>@latest
command to install the latest version of the problematic module. For example, if you're facing an issue with the @refinedev/mantine
module, you can run npm i @refinedev/mantine@latest
to install the latest version of the module.
However, since you're working in a pnpm monorepo, you might face some issues with this approach. In such cases, you can try running pnpm store prune
to purge the cached modules. This is probably happening due to the peer dependencies letting pnpm use an older version of the module rather than the latest. Or if you want, after the creation of the project, you can do pnpm install @refinedev/core@latest
to try installing the latest version of refine's core.
If none of these solutions work, you might have to wait for the GitHub issue to be fixed. Unfortunately, there's no specific date provided for when this issue will be resolved. However, it's believed that it can be resolved within 3-4 weeks. If that doesn't work for you, you can apply to refine's Priority Support Program for more immediate assistance.
Sources:
- Refine FAQ (https://refine.dev/docs/guides-concepts/faq#how-to-solve-module-x-has-no-exported-member-y-error)
- GitHub Issue 1571 (https://github.com/refinedev/refine/issues/1571)
- Discord Support Thread (https://discord.com/channels/837692625737613362/1131143705085087836)
- GitHub Issue 4439 (https://github.com/refinedev/refine/issues/4439)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@293578666041016329> kapa.ai is still learning and improving, please let us know how it did by reacting below
national-gold•8mo ago
@kapa.ai Tried all the solutions. Still didn't work.
Let me check the knowledge base for you. One moment! :books:
----------------------
Hmm, I don't know enough to give you a confident answer yet. It seems like you've tried all the available solutions and they didn't work. I recommend checking out the Refine Documentation (https://refine.dev/docs) for more information or reaching out to the Refine community on their Discord server (https://discord.com/invite/refine) for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@293578666041016329> kapa.ai is still learning and improving, please let us know how it did by reacting below
national-gold•8mo ago
If anyone stumbled on this, the solutions still doesn't fix it (still shows the typescript error) however it now can give me autocomplete when importing (which is good enough for now).
quickest-silver•8mo ago
Hey @sgtpepperino, sorry for the issue. Can you open up an issue on GitHub preferrably with a minimal reproduction of the issue. If the prune and install is not resolving the issue it might be caused by the dependency differences between projects in the workspace or might be related to something on our end about the production builds/exports 🤔 Thank you for reporting the bug (or a beetle in this case 😅 )
national-gold•8mo ago
@aliemirs No worries, I'll open up an issue as soon as I'm free and I'll mention you here as well 👍
absent-sapphire•5mo ago
Hello, I have same problem with @refinedev/core, and don’t know why
Hooks has no exported member
@kapa.ai @contributor
Let me check the knowledge base for you. One moment! :books:
----------------------
I'm sorry, but your message is not clear. Could you please provide more details or clarify your question? I'm here to help with questions related to Refine, a React-based framework for building data-intensive applications.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@538717491908575242> kapa.ai is still learning and improving, please let us know how it did by reacting below
absent-sapphire•5mo ago
Module "@refinedev/core" has no exported member useOne
@kapa.ai
Let me check the knowledge base for you. One moment! :books:
Sorry @RomaY, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
absent-sapphire•5mo ago
@contributor can someone help me?
quickest-silver•5mo ago
Hey @RomaY, can you open up a new post and provide more info about the issue? You may want to try removing node_modules and reinstall. Also can you try updating Refine packages to latest?