harsh-harlequin
harsh-harlequin5mo ago

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
20 Replies
kapa.ai
kapa.ai5mo ago
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: ----------------------
kapa.ai
kapa.ai5mo ago
<@293578666041016329> kapa.ai is still learning and improving, please let us know how it did by reacting below
harsh-harlequin
harsh-harlequin5mo ago
@kapa.ai Tried all the solutions. Still didn't work.
kapa.ai
kapa.ai5mo ago
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: ----------------------
kapa.ai
kapa.ai5mo ago
<@293578666041016329> kapa.ai is still learning and improving, please let us know how it did by reacting below
harsh-harlequin
harsh-harlequin5mo 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).
magic-amber
magic-amber5mo 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 😅 )
harsh-harlequin
harsh-harlequin5mo ago
@aliemirs No worries, I'll open up an issue as soon as I'm free and I'll mention you here as well 👍
inland-turquoise
inland-turquoise3w ago
Hello, I have same problem with @refinedev/core, and don’t know why Hooks has no exported member @kapa.ai @contributor
kapa.ai
kapa.ai3w ago
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: ----------------------
kapa.ai
kapa.ai3w ago
<@538717491908575242> kapa.ai is still learning and improving, please let us know how it did by reacting below
inland-turquoise
inland-turquoise3w ago
Module "@refinedev/core" has no exported member useOne @kapa.ai
kapa.ai
kapa.ai3w ago
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?
inland-turquoise
inland-turquoise3w ago
@contributor can someone help me?
magic-amber
magic-amber3w 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?
inland-turquoise
inland-turquoise3w ago
@aliemir Yes, I did it all, and it didn’t help. I was just removing unnecessary dependencies in package.json, then for some reason this error occurred, and I put the dependencies back, but the error did not disappear I created a simple new refine app and have the same error
magic-amber
magic-amber3w ago
Are you using Next.js? And does the error also thrown in dev mode?
inland-turquoise
inland-turquoise3w ago
No, I use Vite Without tsc, the server starts and works, but shows an error in the file when importing
magic-amber
magic-amber3w ago
Can you move this to our GitHub issues and provide more info about your project? Like tsconfig file and typescript version etc. I used create-refine-app to create a new vite project using npm and didn’t had any issue with dev and build 🤔 I will try to investigate more and get back to you in GitHub I think I am some kind of able to reproduce the issue by downgrading to typescript@4 from @5. When upgraded again to typescript 5 the issue resolved
inland-turquoise
inland-turquoise3w ago
@aliemir Yes, thank you, it solve problem, but I don’t why, when viewing the hooks that can be taken from refinedev/core, for some reason it does not show them, but there is no longer an error