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

Running the lein .. --rum readme example fails #30

Closed
torgeir opened this issue Jan 25, 2021 · 1 comment
Closed

Running the lein .. --rum readme example fails #30

torgeir opened this issue Jan 25, 2021 · 1 comment

Comments

@torgeir
Copy link

torgeir commented Jan 25, 2021

Hey there!

Running the readme example for rum and npm lein new figwheel-main hello-world.core -- +npm-bundle --rum followed by lein fig:build works as intended, but lein fig:min fails with errors on missing react.

OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Generating fresh figwheel-main project.
  To get started:
  -->  Change into the 'hello-world.core' directory
  -->  IMPORTANT: run 'npm install'
  -->  Start build with 'lein fig:build'



❯ cd hello-world.core
❯ npm install
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

> [email protected] install /Users/Torgeir/Code/hello-world.core/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN hello-world.core No repository field.
npm WARN hello-world.core No license field.

added 397 packages from 230 contributors and audited 397 packages in 11.659s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities





❯ lein fig:min
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
2021-01-25 08:11:53.476:INFO::main: Logging initialized @3774ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Validating figwheel-main.edn
[Figwheel] figwheel-main.edn is valid \(ツ)/
[Figwheel] Compiling build dev to "resources/public/cljs-out/dev/main.js"
[Figwheel] Successfully compiled build dev to "resources/public/cljs-out/dev/main.js" in 13.002 seconds.
[Figwheel] Bundling: npx webpack --mode=production ./resources/public/cljs-out/dev/main.js --output-path ./resources/public/cljs-out/dev --output-filename main_bundle.js
[Figwheel:SEVERE] Bundling command failed
Hash: 4db3d6cafba81684ef93
Version: webpack 4.46.0
Time: 2948ms
Built at: 25.01.2021 08:12:14
 1 asset
Entrypoint main = main_bundle.js
[0] ./resources/public/cljs-out/dev/main.js 245 KiB {0} [built]
[1] (webpack)/buildin/global.js 472 bytes {0} [built]

ERROR in ./resources/public/cljs-out/dev/main.js
Module not found: Error: Can't resolve 'react' in '/Users/Torgeir/Code/hello-world.core/resources/public/cljs-out/dev'
 @ ./resources/public/cljs-out/dev/main.js 58:103-119

Exception in thread "main" Syntax error compiling at (/private/var/folders/37/f16yrb690pj35_75pl1bxgv40000kt/T/form-init10896007728087526952.clj:1:126).
Bundling command failed
Hash: 4db3d6cafba81684ef93
Version: webpack 4.46.0
Time: 2948ms
Built at: 25.01.2021 08:12:14
 1 asset
Entrypoint main = main_bundle.js
[0] ./resources/public/cljs-out/dev/main.js 245 KiB {0} [built]
[1] (webpack)/buildin/global.js 472 bytes {0} [built]

ERROR in ./resources/public/cljs-out/dev/main.js
Module not found: Error: Can't resolve 'react' in '/Users/Torgeir/Code/hello-world.core/resources/public/cljs-out/dev'
 @ ./resources/public/cljs-out/dev/main.js 58:103-119

	at clojure.lang.Compiler.load(Compiler.java:7647)
	at clojure.lang.Compiler.loadFile(Compiler.java:7573)
	at clojure.main$load_script.invokeStatic(main.clj:452)
	at clojure.main$init_opt.invokeStatic(main.clj:454)
	at clojure.main$init_opt.invoke(main.clj:454)
	at clojure.main$initialize.invokeStatic(main.clj:485)
	at clojure.main$null_opt.invokeStatic(main.clj:519)
	at clojure.main$null_opt.invoke(main.clj:516)
	at clojure.main$main.invokeStatic(main.clj:598)
	at clojure.main$main.doInvoke(main.clj:561)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: Bundling command failed
Hash: 4db3d6cafba81684ef93
Version: webpack 4.46.0
Time: 2948ms
Built at: 25.01.2021 08:12:14
 1 asset
Entrypoint main = main_bundle.js
[0] ./resources/public/cljs-out/dev/main.js 245 KiB {0} [built]
[1] (webpack)/buildin/global.js 472 bytes {0} [built]

ERROR in ./resources/public/cljs-out/dev/main.js
Module not found: Error: Can't resolve 'react' in '/Users/Torgeir/Code/hello-world.core/resources/public/cljs-out/dev'
 @ ./resources/public/cljs-out/dev/main.js 58:103-119
 {:figwheel.main/error true, :cmd ["npx" "webpack" "--mode=production" "./resources/public/cljs-out/dev/main.js" "--output-path" "./resources/public/cljs-out/dev" "--output-filename" "main_bundle.js"], :exit-code 2, :stdout "Hash: 4db3d6cafba81684ef93\nVersion: webpack 4.46.0\nTime: 2948ms\nBuilt at: 25.01.2021 08:12:14\n 1 asset\nEntrypoint main = main_bundle.js\n[0] ./resources/public/cljs-out/dev/main.js 245 KiB {0} [built]\n[1] (webpack)/buildin/global.js 472 bytes {0} [built]\n\nERROR in ./resources/public/cljs-out/dev/main.js\nModule not found: Error: Can't resolve 'react' in '/Users/Torgeir/Code/hello-world.core/resources/public/cljs-out/dev'\n @ ./resources/public/cljs-out/dev/main.js 58:103-119\n", :stderr ""}
	at figwheel.main$run_bundle_cmd_STAR_.invokeStatic(main.cljc:135)
	at figwheel.main$run_bundle_cmd_STAR_.invoke(main.cljc:123)
	at figwheel.main$run_bundle_cmd.invokeStatic(main.cljc:144)
	at figwheel.main$run_bundle_cmd.invoke(main.cljc:140)
	at figwheel.main$run_bundle_cmd.invokeStatic(main.cljc:141)
	at figwheel.main$run_bundle_cmd.invoke(main.cljc:140)
	at figwheel.main$wrap_with_bundling$fn__6927.doInvoke(main.cljc:155)
	at clojure.lang.RestFn.applyTo(RestFn.java:146)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.core$apply.invoke(core.clj:660)
	at figwheel.main$wrap_with_build_hooks$fn__6950.doInvoke(main.cljc:209)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.core$apply.invoke(core.clj:660)
	at figwheel.main$wrap_with_compiler_passes$fn__6953.doInvoke(main.cljc:218)
	at clojure.lang.RestFn.invoke(RestFn.java:457)
	at figwheel.main$build.invokeStatic(main.cljc:1772)
	at figwheel.main$build.invoke(main.cljc:1768)
	at figwheel.main$default_compile$fn__9244.invoke(main.cljc:2193)
	at figwheel.main$default_compile.invokeStatic(main.cljc:2192)
	at figwheel.main$default_compile.invoke(main.cljc:2167)
	at figwheel.main$build_once_main_opt.invokeStatic(main.cljc:656)
	at figwheel.main$build_once_main_opt.invoke(main.cljc:655)
	at cljs.cli$main.invokeStatic(cli.clj:703)
	at cljs.cli$main.doInvoke(cli.clj:692)
	at clojure.lang.RestFn.applyTo(RestFn.java:139)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.core$apply.invoke(core.clj:660)
	at cljs.main$_main.invokeStatic(main.clj:65)
	at cljs.main$_main.doInvoke(main.clj:56)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.core$apply.invoke(core.clj:660)
	at figwheel.main$_main$fn__9440.invoke(main.cljc:2553)
	at clojure.core$with_redefs_fn.invokeStatic(core.clj:7514)
	at clojure.core$with_redefs_fn.invoke(core.clj:7498)
	at figwheel.main$_main.invokeStatic(main.cljc:2551)
	at figwheel.main$_main.doInvoke(main.cljc:2529)
	at clojure.lang.RestFn.invoke(RestFn.java:457)
	at clojure.lang.Var.invoke(Var.java:399)
	at user$eval140.invokeStatic(form-init10896007728087526952.clj:1)
	at user$eval140.invoke(form-init10896007728087526952.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:7176)
	at clojure.lang.Compiler.eval(Compiler.java:7166)
	at clojure.lang.Compiler.load(Compiler.java:7635)
	... 12 more

Subsequently installing react builds without issues

❯ npm install react@17
npm WARN hello-world.core No repository field.
npm WARN hello-world.core No license field.

+ [email protected]
added 3 packages from 2 contributors and audited 400 packages in 2.65s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities




❯ lein fig:min
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
2021-01-25 08:13:06.193:INFO::main: Logging initialized @3676ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Validating figwheel-main.edn
[Figwheel] figwheel-main.edn is valid \(ツ)/
[Figwheel] Compiling build dev to "resources/public/cljs-out/dev/main.js"
[Figwheel] Successfully compiled build dev to "resources/public/cljs-out/dev/main.js" in 9.706 seconds.
[Figwheel] Bundling: npx webpack --mode=production ./resources/public/cljs-out/dev/main.js --output-path ./resources/public/cljs-out/dev --output-filename main_bundle.js
❯ http-server resources/public
Starting up http-server, serving resources/public
Available on:
  http://127.0.0.1:8080

but fails at runtime

still fails at runtime

I also tried installing react-dom with npm, and excluding react and react-dom from the project.clj, as rum depends on both the cljsjs variants, to no avail. Changing to react and react-dom @16 as this is what rum depends also did not help.

Suggestions appreciated!

@bhauman
Copy link
Owner

bhauman commented Apr 30, 2022

Yeah this is an issue in Rum that has been around for quite some time now. There is a work around mentioned in this issue on rum:

tonsky/rum#211

@bhauman bhauman closed this as completed Apr 30, 2022
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