ChainSafe / filsnap

MetaMask snap for interacting with Filecoin dapps.
https://filsnap.chainsafe.io
Apache License 2.0
107 stars 41 forks source link

yarn build: Error: error:0308010C:digital envelope routines::unsupported #259

Open vorburger opened 1 year ago

vorburger commented 1 year ago

I am trying to build this project to fix https://github.com/ChainSafe/filsnap/issues/258, but:

$ yarn build
➤ YN0000: [@chainsafe/filsnap-adapter]: Process started
➤ YN0000: [@chainsafe/filsnap]: Process started
➤ YN0000: [@chainsafe/filsnap-adapter]: Process exited (exit code 0), completed in 6s 475ms
➤ YN0000: [@chainsafe/filsnap]: Build success: 'src/index.ts' bundled as 'dist/bundle.js'!
➤ YN0000: [@chainsafe/filsnap]: Manifest Success: Validated snap.manifest.json!
➤ YN0000: [@chainsafe/filsnap]: Eval Success: evaluated 'dist/bundle.js' in SES!
➤ YN0000: [@chainsafe/filsnap]: Process exited (exit code 0), completed in 12s 703ms
➤ YN0000: [example]: Process started
➤ YN0000: [example]: Creating an optimized production build...
➤ YN0000: [example]: Error: error:0308010C:digital envelope routines::unsupported
➤ YN0000: [example]:     at new Hash (node:internal/crypto/hash:71:19)
➤ YN0000: [example]:     at Object.createHash (node:crypto:133:10)
➤ YN0000: [example]:     at module.exports (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/util/createHash.js:135:53)
➤ YN0000: [example]:     at NormalModule._initBuildHash (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/NormalModule.js:417:16)
➤ YN0000: [example]:     at handleParseError (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/NormalModule.js:471:10)
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/NormalModule.js:503:5
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/NormalModule.js:358:12
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:373:3
➤ YN0000: [example]:     at iterateNormalLoaders (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
➤ YN0000: [example]:     at iterateNormalLoaders (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:236:3
➤ YN0000: [example]:     at runSyncOrAsync (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
➤ YN0000: [example]:     at iterateNormalLoaders (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
➤ YN0000: [example]:     at Array.<anonymous> (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
➤ YN0000: [example]:     at Storage.finished (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
➤ YN0000: [example]: /home/vorburger/git/github.com/ChainSafe/filsnap/packages/example/node_modules/react-scripts/scripts/build.js:19
➤ YN0000: [example]:   throw err;
➤ YN0000: [example]:   ^
➤ YN0000: [example]:
➤ YN0000: [example]: Error: error:0308010C:digital envelope routines::unsupported
➤ YN0000: [example]:     at new Hash (node:internal/crypto/hash:71:19)
➤ YN0000: [example]:     at Object.createHash (node:crypto:133:10)
➤ YN0000: [example]:     at module.exports (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/util/createHash.js:135:53)
➤ YN0000: [example]:     at NormalModule._initBuildHash (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/NormalModule.js:417:16)
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/NormalModule.js:452:10
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/webpack/lib/NormalModule.js:323:13
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:367:11
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:233:18
➤ YN0000: [example]:     at context.callback (/home/vorburger/git/github.com/ChainSafe/filsnap/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
➤ YN0000: [example]:     at /home/vorburger/git/github.com/ChainSafe/filsnap/packages/example/node_modules/babel-loader/lib/index.js:59:103 {
➤ YN0000: [example]:   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
➤ YN0000: [example]:   library: 'digital envelope routines',
➤ YN0000: [example]:   reason: 'unsupported',
➤ YN0000: [example]:   code: 'ERR_OSSL_EVP_UNSUPPORTED'
➤ YN0000: [example]: }
➤ YN0000: [example]:
➤ YN0000: [example]: Node.js v18.16.0
➤ YN0000: [example]: Process exited (exit code 1), completed in 2s 422ms
➤ YN0000: The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph
➤ YN0000: Failed with errors in 15s 154ms

https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

$ NODE_OPTIONS=--openssl-legacy-provider yarn build
➤ YN0000: [@chainsafe/filsnap-adapter]: Process started
➤ YN0000: [@chainsafe/filsnap]: Process started
➤ YN0000: [@chainsafe/filsnap-adapter]: Process exited (exit code 0), completed in 4s 315ms
➤ YN0000: [@chainsafe/filsnap]: Build success: 'src/index.ts' bundled as 'dist/bundle.js'!
➤ YN0000: [@chainsafe/filsnap]: Manifest Success: Validated snap.manifest.json!
➤ YN0000: [@chainsafe/filsnap]: Eval Success: evaluated 'dist/bundle.js' in SES!
➤ YN0000: [@chainsafe/filsnap]: Process exited (exit code 0), completed in 11s 883ms
➤ YN0000: [example]: Process started
➤ YN0000: [example]: Creating an optimized production build...
➤ YN0000: [example]: Compiled successfully.
➤ YN0000: [example]:
➤ YN0000: [example]: File sizes after gzip:
➤ YN0000: [example]:
➤ YN0000: [example]:   131.99 KB  build/static/js/2.324c3289.chunk.js
➤ YN0000: [example]:   6.95 KB    build/static/js/main.08f8950d.chunk.js
➤ YN0000: [example]:   770 B      build/static/js/runtime-main.65dced8a.js
➤ YN0000: [example]:   72 B       build/static/css/main.afd7172b.chunk.css
➤ YN0000: [example]:
➤ YN0000: [example]: The project was built assuming it is hosted at /.
➤ YN0000: [example]: You can control this with the homepage field in your package.json.
➤ YN0000: [example]:
➤ YN0000: [example]: The build folder is ready to be deployed.
➤ YN0000: [example]: You may serve it with a static server:
➤ YN0000: [example]:
➤ YN0000: [example]:   npm install -g serve
➤ YN0000: [example]:   serve -s build
➤ YN0000: [example]:
➤ YN0000: [example]: Find out more about deployment here:
➤ YN0000: [example]:
➤ YN0000: [example]:   https://cra.link/deployment
➤ YN0000: [example]:
➤ YN0000: [example]: Process exited (exit code 0), completed in 19s 684ms
➤ YN0000: Done in 31s 585ms

Should this workaround (NODE_OPTIONS=--openssl-legacy-provider) really be required, or can this fixed?