Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the significance of stats failing and how to prevent? #338

Closed
evbo opened this issue May 15, 2020 · 6 comments
Closed

What is the significance of stats failing and how to prevent? #338

evbo opened this issue May 15, 2020 · 6 comments

Comments

@evbo
Copy link

evbo commented May 15, 2020

Webpack appears to correctly build an electron app that I can run with electron, but at the very end I see the message:

[info] Writing scalajs.webpack.config.js
[error] Error parsing webpack stats output
[error] /assets: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /time: JsonValidationError(List(error.path.missing),WrappedArray())

I see in the change log this is expected if any std output gets generated:
https://github.com/scalacenter/scalajs-bundler/blob/08cd66ba26716301c09cae5853b42a7cc31e1c05/manual/src/ornate/changelog.md

So is it a concern? Any thoughts on how I can silence std output to avoid this error?

@cquiroz
Copy link
Collaborator

cquiroz commented May 16, 2020

the plugin will read the stats produced by webpack to identify the assets it built. The error maybe an indication that the format changed.
What version of webpack are you using?

@evbo
Copy link
Author

evbo commented May 16, 2020

Sorry should have included that:

Plugins:
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.17.0")

Settings:
version in webpack := "4.39.1",
version in startWebpackDevServer := "3.7.2",

I also just tried these versions and I get the same error:

version in webpack := "4.43.0",
version in startWebpackDevServer := "3.11.0",

thanks for the quick response. Just to clearly emphasize, this is only an issue for electron, whereby the best practice (no official documentation on this that I could find) seems to be configuring a multi-compiler like so:
https://github.com/tarunlalwani/electron-webpack-typescript-boilerplate/blob/master/webpack.config.js
https://www.sitepen.com/blog/getting-started-with-electron-typescript-react-and-webpack/

If I just make a conventional config, an object not an array of objects, I do not see any errors.

@evbo
Copy link
Author

evbo commented May 22, 2021

Any ideas how to debug this issue? One unfortunate side effect is that the exit code causes jenkins builds to fail even though the build is actually successful.

Thanks

@cquiroz cquiroz closed this as completed Jun 12, 2021
@cquiroz cquiroz reopened this Jun 12, 2021
@evbo
Copy link
Author

evbo commented Jul 6, 2021

Here's an example of it failing (now with bundler: 0.20.0 and same webpack as before). Even though I had a legitimate error with a JSImport referencing a ".conf" file that should have been a ".json" file, the error seems to be getting swallowed by this instead (no errors were shown prior in the build):

[info] Thanks for using Webpack!
[info] Please consider donating to our Open Collective
[info] to help us maintain this package.
[info] Donate: https://opencollective.com/webpack/donate
[error] npm notice created a lockfile as package-lock.json. You should commit this file.
[error] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: dmg-license@^1.0.8 (node_modules/dmg-builder/node_modules/dmg-license):
[error] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[error] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
[error] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[error] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
[error] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[error] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
[error] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[error] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iconv-corefoundation@^1.1.6 (node_modules/dmg-license/node_modules/iconv-corefoundation):
[error] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[error] npm WARN [email protected] requires a peer of stylis@^3.5.0 but none is installed. You must install peer dependencies yourself.
[info] added 1336 packages from 783 contributors and audited 1346 packages in 245.049s
[info] 99 packages are looking for funding
[info] run npm fund for details
[info] found 5 vulnerabilities (2 low, 2 moderate, 1 high)
[info] run npm audit fix to fix them, or npm audit for details
[info] Writing scalajs.webpack.config.js
[info] Bundling the application with its NPM dependencies
[error] Error parsing webpack stats output
[error] /assets: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /time: JsonValidationError(List(error.path.missing),WrappedArray())
[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:295)
[error] at scala.util.Either.fold(Either.scala:192)
[error] at scalajsbundler.Webpack$.run(Webpack.scala:295)
[error] at scalajsbundler.Webpack$.bundle(Webpack.scala:189)
[error] at scalajsbundler.sbtplugin.WebpackTasks$.$anonfun$webpack$2(WebpackTasks.scala:52)
[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.WebpackTasks$.$anonfun$webpack$1(WebpackTasks.scala:55)
[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:834)
[error] (client / Compile / fullOptJS / webpack) Non-zero exit code: 2
[error] Total time: 322 s (05:22), completed Jul 5, 2021, 11:27:36 PM

@evbo
Copy link
Author

evbo commented Jul 27, 2021

as a debugging tool, running webpack manually will at least show the true underlying issue.

(cd client/target/scala-2.13/scalajs-bundler/main/ && node node_modules/webpack/bin/webpack --bail --profile --config webpack-fullopt.config.js)

So this could very well be a bug with scalajs bundler handling stats output incorrectly

@evbo
Copy link
Author

evbo commented Mar 9, 2022

This appears to be a duplicate of:
#408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants