electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box

Home Page:https://www.electron.build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Cannot find module 'fs/promises' 2

faelfquadros opened this issue · comments

Recently I had the error below. Using ubunto 20.04, electron 8.2.5, electron-builder 22.6.0, electron-updater 4.3.1, I updated all previous packages and the error persists. I've even tested it with node 12, 14 and 16. I've also performed the same tests on another ubunto and the error persists, has anyone gone through something similar ?

Error print

error2

When I change the call from 'fs/promises' to ('fs').promises in the package directly, it works perfectly.

I'm also experiencing the same thing. As others have said, changing the fs/promises part of the electron-updater code works fine, but I don't think this is the right solution. It seems that I had the same problem before, and there is only one thing to say to upgrade/download the version, so it is not practically helpful.

Same issue here with electron-builder 22.14.5 and 22.14.9

Same issue on m1 mac, node 16. Changing the require("fs/promises") to ("fs").promises of electron-updater code in node_modules can solve this. But it's not a good solution. Waiting new version of electron-builder

This issue also exists on CentOS Stream 8. It seems that support for pre-Node v12 was dropped with anything post 22.10? Not sure why a minor release would break compatibility that was there previously (unless it was never intended to be supported?)

@weskerfoot @y122972 @sparticvs @rafaelfquadros
It has been confirmed that this error does not occur if the node version for building the electronjs app is set to 14 or higher and the electronjs version is changed to the last version of the 12 version.

"electron-updater": "4.3.9" remove ^ from package json worked for me

"electron-updater": "4.3.9" remove ^ from package json worked for me

That actually worked. I'm using Node 12, electron 7.2 and this exact version of electron updater. Didnt't want to upgrade Electron and other packages due to this errors, because it can cause a lot of others problems.

Hope they figure it out this problem soon.

I have faced this issue for my electron app and followed the solutions above and now it is working .
Can anyone tell why this issue occurred. I did not change any of my packages but all of a sudden fs/promisses error is raised.

I have faced this issue for my electron app and followed the solutions above and now it is working . Can anyone tell why this issue occurred. I did not change any of my packages but all of a sudden fs/promisses error is raised.

what solution?

I have faced this issue for my electron app and followed the solutions above and now it is working . Can anyone tell why this issue occurred. I did not change any of my packages but all of a sudden fs/promisses error is raised.

what solution?

"electron-updater": "4.3.9" remove ^ from package json worked for me

It looks like you followed this way. I hope you give it a try.

I have faced this issue for my electron app and followed the solutions above and now it is working . Can anyone tell why this issue occurred. I did not change any of my packages but all of a sudden fs/promisses error is raised.

what solution?

"electron-updater": "4.3.9" remove ^ from package json worked for me

It looks like you followed this way. I hope you give it a try.

@search5 i have tried "electron-updater": "4.3.9" removing ^ and worked for me.Why i have to do this any reason behind this?

hi
the reason why u have to remove ^ from package json is Caret Ranges npm automatically update the next version like this :

  • ^1.2.3 := >=1.2.3 <2.0.0-0
  • ^0.2.3 := >=0.2.3 <0.3.0-0
  • ^0.0.3 := >=0.0.3 <0.0.4-0

so removing the ^ will fix the exact version.
if im wrong someone please correct me ☺️
cheers

@aymengraoui that was helpful.

Does this issue happen with electron 12?
Curious if the node API in electron 8 is causing the issue, as the PromisesAPI history is:

v14.0.0 | Exposed as require('fs/promises').
v10.1.0 | The API is accessible via require('fs').promises only.

https://nodejs.org/docs/latest-v16.x/api/fs.html#promises-api

Electron upgraded to node 14 in electron 12, so I'm wondering if this is a backward compatibility issue.

i came this problem。 But I fixed it by switching node version from 16.x to 14.x。

Fixed in #6594
Currently in Alpha release

update the electron version work for me