Error in using new library

Hello everyone,

I am currently doing a challenge on react and I wanted to use the ‘react-router-dom’ library version “^5.3.3” (react-router-dom - npm). When importing the library in my App.jsx file, I get the following error:
Uncaught SyntaxError: The requested module ‘/node_modules/.vite/react-router-dom.js?v=b829d37b’ does not provide an export named ‘useNavigate’

Is there a way to have a look at the “node_modules” generated? Is it an issue with the “vite” tool?
Shouldn’t it be possible to create a router to have multiple pages in the webapp?

Thank you in advance!

Well, here are some answers to your 3rd paragraph:

Answer 1: To see the “node_modules” folder, open the terminal and type: “nano /node_modules/.vite/react-router-dom.js?v=b829d37b”. If that doesn’t work, try “nano /node_modules/.vite/react-router-dom.js”.
Answer 2. I think there isn’t…
Answer 3: Maybe

Hope this helps!

Thank you very much for the quick reply!

I have looked a bit at the node_module folder and the ‘react-router-dom.js’ doesn’t seem to have any issues and the function that I am calling are being exported from the ‘react-router-dom.js’.

For the reactrouter link you sent me, they are using the ‘react-router-dom’: React Router | Tutorial

After spending time looking for the issue, I decided to uninstall the library on the terminal and re-installed a previous version to see if it would work better. However, the ‘vite’ library got also removed from the node_modules. After reinstalling it, the page is now always rebooting and I am getting the following error:

WebSocket server error:
Error: listen EACCES: permission denied

Do you know where I should run the chmod command?

No idea :frowning:
Maybe this can help you:

Can you show the (minimized =) code for your App.jsx? That might give a clue on why you might be getting this error. From the error, it looks like you’re importing the react-router-dom dependency from the .vite module, rather than loading the “real” version.

1 Like

Thanks to both of you!
I just had to delete the project and copy the doe in a new one. The react-router-dom library is now recognized.

1 Like

Great! :grin: It must be a bug :lady_beetle: in your project