mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Error: Cannot find module 'fs/promises' #725
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Cedric-LE on GitHub (Nov 25, 2021).
Originally assigned to: @GregorBiswanger on GitHub.
I have been building an application with Electron.NET for several years that works well. Recently, I rebuilt the application successfully but when I launch the app, I get the following error message in a popup:
Error: Cannot find module 'fs/promises'
Stack:
...\AppUpdater.js
...\main.js
...\autoUpdater.js
I can't use the file browser or access the dev tools of the app.
I can't solve my problem. I tried to use older versions of electron builder, 22.10.5 in particular by installing it globally, but this does not solve my bug.
I went back to the package.json of my application at a point where I was sure that it worked, but I still have this problem. I regenerated the lock package, removed the node_modules, reinstalled node js 14.17.1.
I'm going in circles. I don't know how to debug this problem.
@izakntun commented on GitHub (Nov 26, 2021):
you have any soluction? in my work team we have the same problem, from yesterday we could not compile the project.
@nyxiscoo1 commented on GitHub (Nov 26, 2021):
We can compile, but when it starts error message box appears.
I fixed it in the following way:
package.json(instructions below)resource/app.asarelectronize buildI replace producedresource/app.asarwith previously copied good oneHow to create app.asar.
When you call
ecectronize buildyou can see build directory and commands, in my case it'sApp\obj\desktop\custom:package.json, open it and changeelectron-updaterfrom^4.3.5to4.3.9npm install --productionnpx electron-builder --config=./bin/electron-builder.json --win --ia32 -c.electronVersion=11.1.1exact command line you can see inelectronize buildoutput.appOutDir=...\App\bin\Desktop\win-ia32-unpackedthen you can find yourapp.asarinApp\bin\Desktop\win-ia32-unpacked\resources\app.asar@izakntun commented on GitHub (Nov 26, 2021):
this solution is good for to do the executable file, but isn't our case because this problem occurs when run
electronize start:(@Cedric-LE commented on GitHub (Nov 29, 2021):
Thx frninja
In my opinion, the best way to fix the bug is to regenerate ElectronNet.CLI.
@jim-lin507 commented on GitHub (Dec 1, 2021):
For Electron.NET 9.31.2, I uninstalled ElectronNet.CLI 9.31.2, then installed ElectronNet.CLI 13.5.1. It works for me so far.
But if the specific version of electron-builder can be used during building, it would be able to solve the root issue.
@vsmike commented on GitHub (Dec 1, 2021):
I am also getting errors and need help. I can run electronize start with no issues, but when running the executable I get this error as well. Please help. I plan to try the above workaround for now, [Did not work]. BLOCKED
Electron.NET API 15.3.1
Node version v17.2.0
Dotnet core 5.0
electron-builder 22.14.5
Windows 11
@vsmike commented on GitHub (Dec 1, 2021):
Ok I was able to get it working...I upgraded package.json in the following way.
"electron-updater": "4.6.1"
"electron": "^16.0.3",
And following Cedric-LE example. I ran "buildAll" instead of buildReleaseNuGetPackages.cmd. I will update to the latest electron build.
@rajeshs-logicmatter commented on GitHub (Dec 5, 2021):
I have fixed this issue by doing following changes to my project
@yshulin commented on GitHub (Dec 8, 2021):
Yes, I just only upgraded electron-updater to 4.3.9 and ran "buildAll.cmd", It works fine!
Thanks a lot!
@sarrascaeta commented on GitHub (Apr 13, 2022):
I was getting this issue too, running the
build /target wincommand. There's a lot of potential fixes here, but my fix was very simple, and maybe it shines some light on the bug.Steps:
node_modulespackage-lock.jsonnpm install@Liam2349 commented on GitHub (Apr 20, 2022):
Hi, I've tried every solution in here and I still get this error, both when running the built Windows .exe and when running "electronize start".
I've encountered this before and found that upgrading Node.js resolved it, but not this time.
Is it possible to just remove this electron-updater? I don't use it in my own code.
Currently unable to release any builds.
@Liam2349 commented on GitHub (Apr 20, 2022):
I did more testing and what worked for me was setting ElectronNET.Host's package.json to electron-updater 4.6.1 and electron ^16.0.3, running buildAll.cmd, running buildReleaseNuGetPackages.cmd, and using that new API package. The buildAll installs the CLI package. This was vsmike's suggestion.
Other steps I took before reaching this fix:
Tested my project in a clean virtual machine and this error still occurs, so it's not an environment issue.
My regular desktop that produces this error is running Windows 10, the VM runs Windows 11.
I have tried setting electron-updater in my project's package.json to 4.3.9. I have tried doing it in ElectronNET.Host's package.json and then running buildAll.cmd to install this new CLI version.
I've used buildReleaseNuGetPackages.cmd and used this new API NuGet package with my project.
I've deleted every node_modules and package-lock.json file in my project, then ran "npm install" or "npm install --production".
I've tried using the 13.5.1 versions of the CLI and API.
I've cleaned and rebuilt my solution.
@GregorBiswanger commented on GitHub (Mar 28, 2023):
🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉
With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
@mahesh-kockpit commented on GitHub (Apr 14, 2023):
Solution:
Command : dotnet tool install --global ElectronNET.CLI --version 13.5.1
That's it