Unable to resolve path to module error when building (nextjs) in server
Opened this issue · 3 comments
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.
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?
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
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?