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

When execute command "clj -M -m krell.main -co build.edn -c -r", error encounter #142

Open
dataseriesIO opened this issue Aug 3, 2021 · 10 comments

Comments

@dataseriesIO
Copy link

dataseriesIO commented Aug 3, 2021

Following the wiki to install krell in an existing AwesomeProject, when execute the following command in CLI,
got an error.

MacBookPro:AwesomeProject $ clj -M -m krell.main -co build.edn -c -r
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Waiting for device connection on port 5001
ClojureScript 1.10.844
cljs.user=> clojure.lang.ExceptionInfo: Unexpected error during REPL initialization #:cljs.repl{:error :init-failed}
at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:1220)
at cljs.repl$repl_STAR_.invoke(repl.cljc:1033)
at cljs.cli$repl_opt.invokeStatic(cli.clj:325)
at cljs.cli$repl_opt.invoke(cli.clj:312)
at cljs.cli$default_compile.invokeStatic(cli.clj:534)
at cljs.cli$default_compile.invoke(cli.clj:486)
at krell.repl$krell_compile.invokeStatic(repl.clj:236)
at krell.repl$krell_compile.invoke(repl.clj:226)
at cljs.cli$compile_opt.invokeStatic(cli.clj:542)
at cljs.cli$compile_opt.invoke(cli.clj:540)
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:669)
at clojure.core$apply.invoke(core.clj:662)
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:667)
at clojure.core$apply.invoke(core.clj:662)
at krell.main$_main.invokeStatic(main.clj:9)
at krell.main$main.doInvoke(main.clj:7)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.main$main_opt.invokeStatic(main.clj:514)
at clojure.main$main_opt.invoke(main.clj:510)
at clojure.main$main.invokeStatic(main.clj:664)
at clojure.main$main.doInvoke(main.clj:616)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:40)
Caused by: clojure.lang.ExceptionInfo: ReferenceError: Can't find variable: cljs {:type :js-eval-exception, :error {:status :exception, :value "ReferenceError: Can't find variable: cljs"}, :repl-env #krell.repl.KrellEnv{:options {:port 5001, :watch-dirs ["src"], :connect-timeout 30000, :eval-timeout 30000, :recompile :direct, :output-dir "target", :main AwesomeProject.core}, :file-index {#object[java.io.File 0x309ac89e "/Users/Shared/Relocated_Items/Security/eUSB/sync/reactNative/projects/AwesomeProject/src"] 1627962714805, #object[java.io.File 0x2db0dd19 "/Users/Shared/Relocated_Items/Security/eUSB/sync/reactNative/projects/AwesomeProject/src/AwesomeProject"] 1627968826799, #object[java.io.File 0x354ff4f6 "/Users/Shared/Relocated_Items/Security/eUSB/sync/reactNative/projects/AwesomeProject/src/AwesomeProject/core.cljs"] 1627968826748}, :socket #object[clojure.lang.Atom 0x36b2b6e6 {:status :ready, :val {:socket #object[java.net.Socket 0x5a9004e1 "Socket[addr=/172.30.206.244,port=49559,localport=5001]"], :in #object[java.io.BufferedReader 0x17af9f67 "java.io.BufferedReader@17af9f67"], :out #object[java.io.BufferedWriter 0x6b6d8671 "java.io.BufferedWriter@6b6d8671"]}}], :state #object[clojure.lang.Atom 0x484b187c {:status :ready, :val {:watcher #object[io.methvin.watcher.DirectoryWatcher 0x1226ba98 "io.methvin.watcher.DirectoryWatcher@1226ba98"], :done true}}]}, :form (set! cljs.core/print-namespace-maps true), :js "(cljs.core.STAR_print_namespace_maps_STAR = true)"}
at cljs.repl$evaluate_form.invokeStatic(repl.cljc:577)
at cljs.repl$evaluate_form.invoke(repl.cljc:498)
at cljs.repl$repl_STAR
.invokeStatic(repl.cljc:1129)
... 31 more

@tetriscode
Copy link

Any luck fixing this?

@jpmonettas
Copy link

Also having this same issue, but after my repl crashes second time I run krell it works.

I also had to run krell with my ip address on linux when using a device, like this clj -M -m krell.main -h 192.168.1.8 -co build.edn -c -r

@metehan
Copy link

metehan commented Sep 21, 2021

I also have same problem and writing my ip address didn't help

and this is react-native error output maybe it will help:

 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method. 
KrellRoot@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:1389:36
RCTView
RCTView
AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:75190:36
scforward(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:82046:28
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method. 
KrellRoot@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:1389:36
RCTView
RCTView
AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:75190:36
scforward(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:82046:28
 LOG  Krell sez howdy, Device ID: goldfish_x86
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method. 
KrellRoot@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:1389:36
RCTView
RCTView
AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:75190:36
scforward(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:82046:28
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method. 
KrellRoot@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:1389:36
RCTView
RCTView
AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:75190:36
scforward(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.scforward&modulesOnly=false&runModule=true:82046:28
 ERROR  Could not evaluate form: (cljs.core._STAR_print_namespace_maps_STAR_ = true) [ReferenceError: Can't find variable: cljs]

@bbuccianti
Copy link

Are you sure you're following the guide?

`
Select the "SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the Android 10 (Q) entry, then make sure the following items are checked:

Android SDK Platform 29
Intel x86 Atom_64 System Image or Google APIs Intel x86 Atom System Image
`

Check that!

@fvkluck
Copy link

fvkluck commented Jan 12, 2022

I'm getting the same error (having followed all instructions carefully). Based on the above comment, I checked the SDK version and noticed that even though I hadn't installed the Android SDK 30, it was in fact installed (Android 11.0 would show 'partially installed').
Looking further, I discovered that the Android SDK 30.0 was installed when running npx react-native run-android. After some googling I looked at my android/build.gradle file, and there the buildToolsVersion, compileSdkVersion and targetSdkVersion were all set to 30 versions.
I changed them to 29 versions, and now when running npx react-native run-android I'm getting an explanation:
WARNING:: The specified Android SDK Build Tools version (29.0.2) is ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.2.

According to this, 4.1.0 is the last Android Gradle Plugin version to support the SDK 29. 4.2.0 was released in March 2021, so to me it seems plausible that this is the cause of this issue.

Disclaimer: this is my first attempt at getting an app to work, and I have no experience with gradle or this ecosystem. I'm not even sure if I 'set' any of the versions in a stable manner :)

I've tried downgrading to 4.1.0 and gradle 6.5, but I haven't succeeded yet. But hopefully the information above helps someone else in analyzing the issue.

@fvkluck
Copy link

fvkluck commented Jan 12, 2022

I looked into it a bit more, and my best guess (but I'm in somewhat over my head here) is that this is something about react-native itself that Krel just happens to run into.

The tutorial in https://reactnative.dev/docs/environment-setup#native clearly states that you require Android SDK 29, however, when I run the command listed there npx react-native init AwesomeProject2 (AwesomeProject was already taken :)), I get the following:

android/build.gradle
16:        classpath("com.android.tools.build:gradle:4.2.2")

and if I then run npx react-native start-android, it will decide to install Android SDK 30 (I assume, but do not have the knowledge to know for certain) because the android gradle plugin 4.2.2 only works with Android SDK 30+)

@fvkluck
Copy link

fvkluck commented Jan 16, 2022

Ok, at least on my system it turned out to be a lot easier than expected. When I run npx react-native init AwesomeProject (without having Android SDK 30 installed), the AwesomeProject/android/build.grade has the compileSdkVersion and the targetSdkVersion both set to 30.

A workaround is to edit both to 29, and then for me everything seems to work (starting the app, autoreloading). I'll keep an eye on issues that I encounter that seem related, and I'll try to figure out how/why the versions were set to 30, but for this sunday morning I'm calling it a day :)

@hadils
Copy link

hadils commented Mar 17, 2022

I'm getting this issue running iOS. I downgraded to 5.2.0 and it went away, but so did the krell_index.js support that I am relying on. Here's my details:

{
  "name": "yardwerkz2",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "storybook": "start-storybook -p 7007",
    "build-storybook": "build-storybook"
  },
  "jest": {
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|@react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base)"
    ],
    "setupFilesAfterEnv": [
      "<rootDir>/__mocks__/globalMock.js"
    ]
  },
  "dependencies": {
    "@aws-amplify/codegen-ui": "^2.1.2",
    "@aws-amplify/core": "^4.4.0",
    "@cljs-oss/module-deps": "^1.1.1",
    "@native-base/icons": "^0.0.11",
    "@react-native-async-storage/async-storage": "^1.16.1",
    "@react-native-community/netinfo": "^8.1.0",
    "@react-native-picker/picker": "^2.3.1",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/native-stack": "^6.5.0",
    "amazon-cognito-identity-js": "^5.2.7",
    "aws-amplify": "^4.3.15",
    "aws-amplify-react-native": "^6.0.3",
    "html-webpack-plugin": "^5.5.0",
    "native-base": "^3.3.7",
    "react": "17.0.2",
    "react-native": "^0.66.4",
    "react-native-action-sheet": "^2.2.0",
    "react-native-device-info": "^8.1.2",
    "react-native-eject": "^0.1.2",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-safe-area-context": "^4.1.3",
    "react-native-screens": "^3.13.1",
    "react-native-svg": "^12.3.0",
    "react-native-tcp-socket": "^5.2.0",
    "react-native-vector-icons": "^9.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@storybook/addon-actions": "^6.4.19",
    "@storybook/addon-knobs": "^6.4.0",
    "@storybook/addon-links": "^5.3",
    "@storybook/addon-ondevice-actions": "^5.3.23",
    "@storybook/addon-ondevice-knobs": "^5.3.25",
    "@storybook/react-native": "^5.3.25",
    "@storybook/react-native-server": "^5.3.23",
    "babel-jest": "^26.6.3",
    "babel-loader": "^8.2.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-dom": "17.0.2",
    "react-test-renderer": "17.0.2"
  }
}

deps.edn:
{:paths     ["src" "test" "js"]
 :deps      {io.vouch/krell                {:mvn/version "0.5.3"}
             ;org.clojure/clojurescript     {:mvn/version "1.11.4"}
             org.clojure/clojure           {:mvn/version "1.10.3"}
             org.clojure/core.async        {:mvn/version "1.5.648"}
             ;com.google.javascript/closure-compiler-unshaded {:mvn/version "v20220202"}
             io.vouch/reagent-react-native {:git/url "https://github.com/vouch-opensource/reagent-react-native.git"
                                            :sha     "0fe1c600c9b81180f76b94ef6004c2f85e7d4aa0"}
             reagent/reagent               {:mvn/version "1.1.1"
                                            :exclusions  [cljsjs/react cljsjs/react-dom]}
             cljsjs/react                  {:mvn/version "18.0.0-rc.0-0"}
             cljsjs/react-dom              {:mvn/version "18.0.0-rc.0-0"}
             cljsjs/react-dom-server       {:mvn/version "18.0.0-rc.0-0"}
             cljsjs/babel-standalone       {:mvn/version "6.18.1-3"}
             com.taoensso/timbre           {:mvn/version "5.1.2"}
             re-frame/re-frame             {:mvn/version "1.3.0-rc3"}

             ;; Datomic
             com.datomic/ion               {:mvn/version "1.0.57"}
             com.datomic/client-cloud      {:mvn/version "1.0.119"}
             com.datomic/dev-local         {:mvn/version "1.0.242"}
             com.google.guava/guava        {:mvn/version "31.1-jre"}

             ;; Logging
             org.slf4j/slf4j-simple        {:mvn/version "1.7.36"}
             }

 :mvn/repos {"datomic-cloud" {:url "s3://datomic-releases-1fc2183a/maven/releases"}}

 :aliases   {:ion-dev   {:main-opts  ["-m" "datomic.ion.dev"]
                         :extra-deps {com.datomic/ion-dev {:mvn/version "1.0.294"}}}
             :clj-tests {:extra-paths ["src/test"]
                         :main-opts   ["-m" "kaocha.runner"]
                         :extra-deps  {lambdaisland/kaocha       {:mvn/version "1.62.993"}
                                       fulcrologic/fulcro-spec   {:mvn/version "3.1.12"}
                                       dev-local-tu/dev-local-tu {:mvn/version "0.2.2"}
                                       orchestra/orchestra       {:mvn/version "0.3.0"}}}}}

Mac OSX 12.5 arm64

@ttchuong
Copy link

In my case, removing node_modules and re-run npm i will resolve this issue.

@mharju
Copy link

mharju commented Sep 26, 2024

This error might be caused due to having wrong METRO_IP in target/closure_bootstrap.js.

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

9 participants