shadaj / slinky

Write Scala.js React apps just like you would in ES6
https://slinky.dev
MIT License
656 stars 57 forks source link

ERR_OSSL_EVP_UNSUPPORTED #597

Open vinjana opened 2 years ago

vinjana commented 2 years ago

This is basically this issue from Stackoverflow.

[error] node:internal/crypto/hash:71
[error]   this[kHandle] = new _Hash(algorithm, xofLen);
[error]                   ^
[error] Error: error:0308010C:digital envelope routines::unsupported
[error]     at new Hash (node:internal/crypto/hash:71:19)
[error]     at Object.createHash (node:crypto:133:10)
[error]     at module.exports (/home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/util/createHash.js:135:53)
[error]     at NormalModule._initBuildHash (/home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:417:16)
[error]     at handleParseError (/home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:471:10)
[error]     at /home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:503:5
[error]     at /home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:358:12
[error]     at /home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:373:3
[error]     at iterateNormalLoaders (/home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
[error]     at Array.<anonymous> (/home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
[error]     at Storage.finished (/home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
[error]     at /home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
[error]     at /home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/graceful-fs/graceful-fs.js:123:16
[error]     at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
[error]   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
[error]   library: 'digital envelope routines',
[error]   reason: 'unsupported',
[error]   code: 'ERR_OSSL_EVP_UNSUPPORTED'
[error] }
[error] Node.js v18.10.0
[error] Failure on parsing the output of webpack: No content to map due to end-of-input
[error]  at [Source: java.lang.ProcessImpl$ProcessPipeInputStream@4f017f72; line: 1, column: 0]
[error] You can try to manually execute the command
[error] node /home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/bin/webpack --bail --profile --json --config /home/user/private/nutriapp/test/target/scala-2.13/scalajs-bundler/main/webpack-opt.config.js

Steps to reproduce

sbt new shadaj/create-react-scala-app.g8 --branch electron
cd test
sbt build
shadaj commented 2 years ago

My guess is that you'll need to bump the Webpack version being used. You should be able to do that in your build.sbt. Can you give that a try?

vinjana commented 2 years ago

Oh. Sorry. I completely new to the stack (including JS). I realize now that the build.sbt contains quite some configuration options. I'll try that.

vinjana commented 2 years ago

O.k. the StackOverflow says this should be solved with webpack 5.54.0+.

Upgrading that in the build.sbt results in Unsupported webpack major version 5 with scalajs-bundler 0.20.0.

Upgrading sbt-scalajs-bundler in the plugins.sbt results in

[error] [webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
[error]  - configuration.devtool should match pattern "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$".
[error]    BREAKING CHANGE since webpack 5: The devtool option is more strict.
[error]    Please strictly follow the order of the keywords in the pattern.
[error]  - configuration.module.rules[1].use[0] has an unknown property 'query'. These properties are valid:
[error]    object { ident?, loader?, options? }
[error] Failure on parsing the output of webpack: No content to map due to end-of-input
[error]  at [Source: (ProcessPipeInputStream); line: 1, column: 0]
[error] You can try to manually execute the command
[error] node /home/kensche/private/nutriapp/my-app/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/bin/webpack --profile --json --config /home/kensche/private/nutriapp/my-app/target/scala-2.13/scalajs-bundler/main/webpack-fastopt.config.js
[error] 
[error] java.lang.RuntimeException: Non-zero exit code: 2
[error]     at scala.sys.package$.error(package.scala:30)
[error]     at scalajsbundler.Webpack$.$anonfun$run$2(Webpack.scala:286)
[error]     at scala.util.Either.fold(Either.scala:192)
[error]     at scalajsbundler.Webpack$.run(Webpack.scala:286)
[error]     at scalajsbundler.Webpack$.bundleLibraries(Webpack.scala:222)
[error]     at scalajsbundler.sbtplugin.LibraryTasks$.$anonfun$bundle$2(LibraryTasks.scala:76)
[error]     at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:80)
[error]     at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:153)
[error]     at sbt.util.Difference.apply(Tracked.scala:414)
[error]     at sbt.util.Difference.apply(Tracked.scala:394)
[error]     at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:149)
[error]     at sbt.util.Difference.apply(Tracked.scala:414)
[error]     at sbt.util.Difference.apply(Tracked.scala:389)
[error]     at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:148)
[error]     at scalajsbundler.sbtplugin.LibraryTasks$.$anonfun$bundle$1(LibraryTasks.scala:79)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]     at sbt.Execute.work(Execute.scala:291)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]     at java.base/java.lang.Thread.run(Thread.java:829)
[error] (Compile / fastOptJS / webpack) Non-zero exit code: 2
[error] Total time: 25 s, completed Oct 3, 2022, 8:45:18 PM

So, upgrading the SBT plugin seems to help, but then the configurations in the project template seem not to match the expectations of webpack 5.