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

Unable to resolve path to module error when building (nextjs) in server #31

Open
OdifYltsaeb opened this issue Jun 3, 2022 · 3 comments

Comments

@OdifYltsaeb
Copy link

When I build the project ( Nextjs ) in the server then I receive the following error:

./pages/assets/index.js
13:21  Error: Unable to resolve path to module 'local-storage-fallback'.  import/no-unresolved

assets page is rather long and imports the package like this:

import storage from 'local-storage-fallback';

when I run the same build script (yarn build) locally, then it works just fine. And the weirdest part is that the package is installed:

johndoe@server:~/dashboard-project$ ls -la node_modules/ | grep local-storage
drwxr-xr-x   3 r00t     r00t       4096 Jun  3 08:30 local-storage-fallback

Do you have any idea why it is happening with this particular package? I've installed them over and over by clearing the whole node_modules folder and reinstalling and that does not seem to improve anything either.

@tamagokun
Copy link
Member

tamagokun commented Jun 6, 2022

my guess would be that your linter can't locate the module, so you get the warning, but it does actually exist and node can resolve it (the builds work). Is this project inside of a monorepo, or does it use any non-standard tooling?

@tamagokun
Copy link
Member

Ah, I see it's only happening on your server? If it's working locally, but not on the server there must be some kind of difference. Permissions, node versions, etc

@OdifYltsaeb
Copy link
Author

sure, but why it's just with that single package? Especially after I went ´rm node_modules/ -rf´ and then installed everything again with same permissions?

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

No branches or pull requests

2 participants