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

"There are too many JS runtimes, don't know which to eval in." #207

Closed
lilactown opened this issue Feb 21, 2018 · 7 comments
Closed

"There are too many JS runtimes, don't know which to eval in." #207

lilactown opened this issue Feb 21, 2018 · 7 comments

Comments

@lilactown
Copy link

Currently building for Node.js. If I kill the built Node.js app, start it, and attempt to evaluate something via nREPL, I get the message: There are too many JS runtimes, don't know which to eval in.

Steps to reproduce:

  1. Create a build that targets :nodejs and starts an nREPL server
  2. In one terminal, start the build: shadow-cljs watch app
  3. In another terminal, start the Node.js server: node target/out/app.js
  4. Connect to the nREPL connection remotely (I'm using CIDER)
    4a. Start the CLJS REPL: (shadow.cljs.devtools.api/nrepl-select :app)
  5. Kill the app using ctrl-c and start it again: node target/out/app.js
  6. Evaluate a form at the remote REPL: (+ 1 1)

Expected result: REPL prints the answer 1
Actual resuult: REPL prints the message There are too many JS runtimes, don't know which to eval in.

@thheller
Copy link
Owner

thheller commented Feb 21, 2018

Which version are you on? There was a bug related to this a while ago (2.0.50ish I think) but it seems to work now?

(shadow.cljs.devtools.api/nrepl-select :script)
To quit, type: :cljs/quit
=> [:selected :script]
(+ 1 2)
There is no connected JS runtime.
;; now starting node
(+ 1 2)
=> 3
;; now killing node by ctrl+c
(+ 1 2)
There is no connected JS runtime.
;; no starting node again
(+ 1 2)
=> 3

@bolasblack
Copy link
Contributor

bolasblack commented Feb 22, 2018

Hi @thheller , I encountered an issue, perhaps also have some relationship with this

The shadow-cljs version: 2.1.23

I am following the guide https://github.com/thheller/shadow-cljs/wiki/Cider

And this is my shadow-cljs.edn:

{:dependencies [[org.clojure/core.async "0.4.474"]
                [cider/cider-nrepl "0.17.0-SNAPSHOT"]]
 :source-paths ["src"]
 :cache-root ".shadow-cljs"
 :builds {:main {:target :npm-module
                 :output-dir "lib"
                 :compiler-options {:source-map true}}}}
user> (shadow.cljs.devtools.api/nrepl-select :main)
To quit, type: :cljs/quit
[:selected :main]
user> (js/console.log "hello")
There is no connected JS runtime.
user> (js/console.log "hello")
There is no connected JS runtime.
user> :cljs/quit
:cljs/quit
user> (shadow.cljs.devtools.api/nrepl-select :main)
To quit, type: :cljs/quit
[:selected :main]
user> (js/console.log "hello")
There is no connected JS runtime.
user> (println "hello")
There is no connected JS runtime.
user> 

@thheller
Copy link
Owner

REPL for a :npm-module is kind of tricky since its meant to be processed by other tools which would most likely break the REPL entirely.

There is no connected JS runtime. means that no node process is running that has loaded the necessary code and connected to the websocket.

You can run shadow-cljs node-repl standalone and then (shadow.cljs.devtools.api/nrepl-select :node-repl) remotely to get a running node process that you can use.

@bolasblack
Copy link
Contributor

bolasblack commented Feb 22, 2018

@thheller Cool!

I found (println "hello") will print hello in the screen I executed shadow-cljs node-repl, Is it possible to print the message in cider?

@thheller
Copy link
Owner

Not currently. Please open a separate ticket for that.

@bolasblack
Copy link
Contributor

Sorry both theller and Lokeh 😂

@lilactown
Copy link
Author

I had an out of date version of shadow-cljs. Closing.

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

3 participants