stevenvachon / hidefile

Hide files and directories on all platforms.
MIT License
29 stars 1 forks source link

Build failure with the latest Node.js version #12

Closed KaminoRyo closed 9 months ago

KaminoRyo commented 9 months ago

I have an Electron app using the hidefile module. However, when I upgrade the Node.js version, the build breaks.

(Some parts have been omitted)
ERROR in ./node_modules/fswin/electron/x64/fswin.node
Module build failed (from ./node_modules/node-loader/dist/cjs.js):
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:68:19)
    at Object.createHash (node:crypto:138:10)
    at getHashDigest (\node_modules\loader-utils\lib\getHashDigest.js:46:34)
    at \node_modules\loader-utils\lib\interpolateName.js:113:11
    at String.replace (<anonymous>)
    at interpolateName (\node_modules\loader-utils\lib\interpolateName.js:110:8)
    at Object.loader (\node_modules\node-loader\dist\index.js:21:49)
 @ ./node_modules/fswin/ sync ^.*\/fswin\.node$ ./electron/x64/fswin.node
 @ ./node_modules/fswin/index.js 3:18-133
 @ ./node_modules/winattr/lib/binding/index.js 2:14-30
 @ ./node_modules/winattr/lib/whichLib.js 25:20-40
 @ ./node_modules/winattr/lib/index.js 4:17-38
 @ ./node_modules/hideFile/index.js 4:16-34

Upon examining the logs, I found that there was a change on the Node.js side due to issues with the OpenSSL module.

  1. The hidefile module (not updated for over 5 years) depends on winattr (not updated for over 5 years).
  2. The winattr module depends on the node-fswin module (named fswin on npm).
  3. The version of the node-fswin module is currently updated, but it has not been reflected in the winattr module.

A quick solution would be to configure it to use an older OpenSSL provider, but it's a bad approach considering future updates. What would be the best practice for handling this situation? It might be beneficial to find an alternative for winattr and fork it, or find a replacement for the hidefile module.

KaminoRyo commented 9 months ago

After considering various options, for now, I am addressing the issue by forcibly overriding the version of fswin used by the winattr module using npm-force-resolutions. The errors have disappeared, and it seems that the build is successful. However, as I haven't conducted rigorous testing, I will report any issues if they arise.