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

Providing a working minimal example #249

Closed
Nathan-Furnal opened this issue Jul 23, 2020 · 5 comments
Closed

Providing a working minimal example #249

Nathan-Furnal opened this issue Jul 23, 2020 · 5 comments

Comments

@Nathan-Furnal
Copy link

Hi,

I tried to setup a small test to play around with Indium :

mkdir test_js
cd test_js/
# Create the .indium.json, how ?
nano .indium.json
touch example.js
emacs example.js

This doesn't work.

My setup was the following during the experiment :

(use-package js2-mode
  :ensure t
  :defer t 
  :mode ("\\.js\\'". js2-mode))

(use-package indium
  :ensure t
  :defer t
  :config 
  (setq indium-chrome-executable "google-chrome"))

The minimal config :

{
  "configurations": [
    {
      "name": "Web project",
      "type": "chrome"
    }
  ]
}

When trying the M-x indium-launch, no url is recognized. Shouldn't it connect to localhost with some default settings?

If what I did is wrong, can someone point me at the correct way to do it?

Thanks for the help,

Nathan

@xuchunyang
Copy link

I'm new to web dev and Indium, the following setup works for me, M-x indium-launch starts a fresh Chrome instance then I can run JS code in the *JS REPL* buffer.

~ $ mkdir /tmp/test
~ $ cd /tmp/test
/tmp/test $ find-file .indium.json
#<buffer test/.indium.json>
/tmp/test $ cat .indium.json
{
    "configurations": [
        {
            "name": "Web project",
            "type": "chrome",
            "url": "file:///tmp/test/index.html"
        }
    ]
}
/tmp/test $ touch index.html

I use the builtin Emacs modes for HTML/CSS/JS and there is no real configuration for indium.

(use-package indium
  :ensure t
  :homepage https://github.com/NicolasPetton/indium
  :about A JavaScript development environment for Emacs
  :info (info "(Indium) Top"))

@mihaiolteanu
Copy link

@xuchunyang doesn't work for me.
@NicolasPetton I agree with OP. I've tried for hours already to make this work.
It worked initially (don't know how, exactly), then I've restarted indium and now it doesn't.
I've looked at all the examples I could find.
I either get the ECONNREFUSED or I get no warning/error but no response on indium-eval-last-node either.
I'm using "file:///". I assume some server should be running for "localhost".

I'm just playing with JavaScript. I have a minimal ~/projects/javascript/play.js that I want to interact with. No fancy stuff. Just the minimal hello world project to get things started.

@joshcho
Copy link

joshcho commented Dec 1, 2022

I have been trying to get this to work for several hours, too, but no success. A minimal reproducible example would be great.

@ecyrb
Copy link

ecyrb commented Jan 18, 2023

If you're attempting to use Indium with chrome, one thing to test is that chrome is correctly opening the remote-debug-port. E.g. on my Mac, Indium by default runs /Applications/Google\ Chrome.app/Contents/MacOS/Google Chrome --remote-debugging-port=9222 — which does not actually open the remote debugging port unless I run with sudo.

One way you can test if chrome has actually opened the remote debugging port is to submit an HTTP request against it, e.g.:
% curl localhost:9222/json

A workaround for chrome on Mac OS X is here: https://github.com/natkuhn/Chrome-debug/

@ecyrb
Copy link

ecyrb commented Jan 18, 2023

Another thing to try if you're getting ECONNREFUSED is to set your host to 0.0.0.0 in your config file. I had mine set to localhost and this seemed to convince Indium's CDP client to try IPv6.

@Nathan-Furnal Nathan-Furnal closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2024
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

5 participants