Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No matching exports error when creating a new framework project using default template #12364

Closed
sriverag opened this issue Nov 23, 2024 · 4 comments
Labels

Comments

@sriverag
Copy link

What version of React Router are you using?

7.0.2

Steps to Reproduce

  1. Create project using npx create-react-router@latest --template remix-run/react-router-templates/default my-project with all defaults. (Y to all prompts)
  2. cd'ed into my-project folder.
  3. Ran npm run dev

Expected Behavior

The app to build successfully.

Actual Behavior

Getting the following error:

✘ [ERROR] No matching export in "node_modules/react-router/dist/development/index.mjs" for import "UNSAFE_detectErrorBoundary"

    ../../node_modules/react-router-dom/dist/index.js:12:9:
      12 │ import { UNSAFE_detectErrorBoundary, Router, UNSAFE_NavigationContext, useHref...
         ╵          ~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/react-router/dist/development/index.mjs" for import "unstable_useBlocker"

    ../../node_modules/react-router-dom/dist/index.js:12:214:
      12 │ ... useMatches, useNavigation, unstable_useBlocker, UNSAFE_DataRouterContext }...
         ╵                                ~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/react-router/dist/development/index.mjs" for import "AbortedDeferredError"

    ../../node_modules/react-router-dom/dist/index.js:13:9:
      13 │ export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, ...
         ╵          ~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/react-router/dist/development/index.mjs" for import "defer"

    ../../node_modules/react-router-dom/dist/index.js:13:337:
      13 │ ...hildren, createRoutesFromElements, defer, generatePath, isRouteErrorRespons...
         ╵                                       ~~~~~

✘ [ERROR] No matching export in "node_modules/react-router/dist/development/index.mjs" for import "json"

    ../../node_modules/react-router-dom/dist/index.js:13:380:
      13 │ ...generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath...
         ╵                                        ~~~~

✘ [ERROR] No matching export in "node_modules/react-router/dist/development/index.mjs" for import "unstable_useBlocker"

    ../../node_modules/react-router-dom/dist/index.js:13:459:
      13 │ ...renderMatches, resolvePath, unstable_useBlocker, useActionData, useAsyncErr...
         ╵                                ~~~~~~~~~~~~~~~~~~~

@sriverag sriverag added the bug label Nov 23, 2024
@sadin999
Copy link

Add: react-router-dom@7.0.1 (if using 7.0.1) explicitly. e.g. npm install react-router-dom@7.0.1

@sriverag
Copy link
Author

@sadin999 - Thank you! This worked.

@aisiklar
Copy link

aisiklar commented Dec 2, 2024

Thanks @sadin999 and @sriverag
I had the same problem (#12414) and this solved my problem too. Just wondering, this seems to be not so common. Why some have it some some don't. Why do we have to explicitly install react-router-dom? If anyone knows?

@wovalle
Copy link

wovalle commented Jan 23, 2025

Can confirm this is still broken.

Just created a new default app npm create react-router

Tried npm run dev and got the same errors.

Ran npm i react-router-dom@latest

Tried the dev server again, worked flawlessly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants