-
Notifications
You must be signed in to change notification settings - Fork 116
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
ModuleNotFoundError: Module not found: Error: Can't resolve 'electron' #2696
Comments
Running into this issue as well- builds fine on Vercel... |
It looks like |
@calavera thx for the reply, below is the log where the issue appears:
web3 uses swarm, swarm uses got, got is requiring electron -- a nasty rabbit hole. The curious part of it is it builds locally just fine, and builds on vercel just fine. The issue is somewhere with how Amplify is building the SSR module. |
@rtscosta this shows a solution to ignore the deprecated package via webpack/nextjs config: sindresorhus/got#345 |
yeah, that sounds like a problem with implicit dependencies. Something installs the electron package in your local system, or Vercel, but not in Amplify. Then webpack tries to import the plugin, and it doesn't work because the implicit dependency is not there 🤔 @rtscosta this is the change you need in your webpack configuration to avoid this problem:
|
Did you manage to solve it? @rtscosta ? I tried with next.config.js
Does not seems to help. |
@en3sis you need to return config as well then only it'll work. Update your code to this and it should start working:
|
|
Hello Sorin, how are you?
I solved the problem changing the App Setting -> Build settings!
Next.js version = 12.1.4
Node.js verdion = 16.14.2
Please, let me know of that solve your issu
Em dom., 8 de mai. de 2022 às 04:03, Sorin C. ***@***.***>
escreveu:
… Did you manage to solve it? @rtscosta <https://github.com/rtscosta> ?
I'm having the same scenario and it's super annoying. I still don't
understand why it would compile on one side and not the other.
I tried with next.config.js
module.exports = {
webpack: (config, { webpack }) => {
config.plugins.push(new webpack.IgnorePlugin({
resourceRegExp: /^electron$/
}));
}
}
Does not seems to help.
—
Reply to this email directly, view it on GitHub
<#2696 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNX6JQUL557F7B6RBEYHY3VI5YM5ANCNFSM5TDROWVQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi guys. I am trying to use Amplify with a React / Next / web3 project. When I tried to build the project, I got the following error on the Frontend build part.
Does any have this erro before or know how to solve it?
2022-04-10T03:00:11.543Z [ERROR]: Error: Command failed with exit code 1: node_modules/.bin/next build
warn - No ESLint configuration detected. Run next lint to begin setup
Failed to compile.
ModuleNotFoundError: Module not found: Error: Can't resolve 'electron' in '/codebuild/output/src624730322/src/taskReward/node_modules/swarm-js/node_modules/got'
> Build error occurred
Error: > Build failed because of webpack errors
at /codebuild/output/src624730322/src/taskReward/node_modules/next/dist/build/index.js:397:19
at async Span.traceAsyncFn (/codebuild/output/src624730322/src/taskReward/node_modules/next/dist/telemetry/trace/trace.js:60:20)
at async Object.build [as default] (/codebuild/output/src624730322/src/taskReward/node_modules/next/dist/build/index.js:77:25)
The text was updated successfully, but these errors were encountered: