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

Cannot start indium #211

Closed
maliky opened this issue Jun 1, 2019 · 9 comments
Closed

Cannot start indium #211

maliky opened this issue Jun 1, 2019 · 9 comments
Labels

Comments

@maliky
Copy link

maliky commented Jun 1, 2019

I'm very sorry not to be able to get on my own even to the first step of setting up indium up and running.

I followed instruction in readthe docs,
but always get the following error when trying to connect to the indium server

Process indium server exited abnormally with code 1
events.js:165
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::13840
    at Server.setupListenHandle [as _listen2] (net.js:1346:14)
    at listenInCluster (net.js:1387:12)
    at Server.listen (net.js:1475:7)
    at start (/usr/lib/node_modules/indium/server/index.js:15:9)
    at Object.<anonymous> (/usr/lib/node_modules/indium/bin/indium:9:23)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1366:8)
    at process._tickCallback (internal/process/next_tick.js:178:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:697:11)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

node is v9.11.2
emacs 26.1
chromium 73.0.3683.8
I have websocket-20190408.152 working fine with ein-mode already
installed indium from melpa
and even with the basic .indium.json

{
    "configurations": [
	{
	    "name": "projet",
	    "type": "chrome"
	}
    ]
}

I get the afor mentionned error.

Is there something to start before connecting to indium via emacs?

@maliky
Copy link
Author

maliky commented Jun 1, 2019

I should mention that I installed with melpa exec-path-from-shell and added

(require 'exec-path-from-shell)
(exec-path-from-shell-initialize)

to my init.el before restarting emacs but still.

@NicolasPetton
Copy link
Owner

Hi!

Indium listens on port 13840, and from the error log, that port is already taken.
It could be that you already have Indium running, did you start it manually?

If so, that's not needed, all you need to do is M-x indium-connect or M-x indium-start.

@maliky
Copy link
Author

maliky commented Jun 3, 2019

Ok, thank you, EADDRINUSE is making sens now.

but starting starting again,
I:

  • open emacs,
  • move to my project directory (foo) where a basic .indium.json is.
  • try to connect with M-x indium-connect

and here's the *indium-debug-log*
indium-debug-log

Sent: ((id . 1) (type . configurations) (payload (action . list) (directory . /foo/)))

Received: ((id . 1) (type . success) (payload . [((name . projet) (type . chrome) (projectFile . /foo/.indium.json) (resolvedRoot . /foo))]))

Sent: ((id . 2) (type . connection) (payload (action . connect) (directory . /foo/) (name . projet)))

Received: ((id . 2) (type . error) (payload (error . connect ECONNREFUSED 127.0.0.1:9222)))


################
/foo/.indium.json

{
    "configurations": [
	{
	    "name": "projet",
	    "type": "chrome"
	}
    ]
}

Messages
Indium server error: connect ECONNREFUSED 127.0.0.1:9222

I don't get where port number 9222 is coming from.
Anyway I've modified the
/foo/.indium.json to

{
    "configurations": [
	{
	    "name": "projet",
	    "type": "chrome",
	    "port": "13840"
	}
    ]
}

I don't get any feedback in the Messages buffer, but I expect a buffer to open with an access to javascript and it does not happen.
the launch fails silently.

Here the indium-debug-log after setting the port

Sent: ((id . 1) (type . configurations) (payload (action . list) (directory . /foo/)))

Received: ((id . 1) (type . success) (payload . [((name . projet) (type . chrome) (port . 13840) (projectFile . /foo/.indium.json) (resolvedRoot . /foo))]))

Sent: ((id . 2) (type . connection) (payload (action . connect) (directory . /foo/) (name . projet)))

@NicolasPetton
Copy link
Owner

The port 9222 is the standard port used in Chrome for remote debugging.
It looks like Chrome is already started, but without remote debugging enabled.

You can do 2 things to fix it:
  • Use M-x indium-launch to let Indium start an instance of Chrome for you with the correct configuration. In this case the configuration file should have a url parameter:
{
  "configurations": [
    {
      "name": "Web project",
      "type": "chrome",
      "url": "http://localhost:8080/index.html",
    }
  ]
}
  • Start Chrome yourself with the correct flags to enable remote debugging, with something like the following:
chrome --remote-debugging-port=9222 https://localhost:8080

It's explained here in the manual: https://indium.readthedocs.io/en/latest/setup.html#getting-up-and-running

Please tell me if it still doesn't work for you.

@maliky
Copy link
Author

maliky commented Jun 3, 2019

I'm very sorry, I'm lacking computer science background and don't quite understand what should happen here.

  • This is probably a very dum question but I'm unsure. Should the web server be started, or is it part of what indium will start ?
    In my case, it has always be started but its root sometime was in a different folder than that for the indium server.

Now, I make sure that I run a small http server with the indium root folder as its root, ie I run
python3 -m http.server 8080 & (also tried with port 9222) in the same folder as indium.
I also make sure that:

  • I have an basic.html file in that folder too,
  • chromium is not started (I'm on linux) ie ps -e | grep chrom returns nothing
    My .indium.json looks like this
{
    "configurations": [
	{
	    "name": "projet",
	    "type": "chrome",
	    "url": "http://localhost:8080/basic.html",
            "port": "8080"
	}
    ]
}

I activate the debug-log (setq indium-client-debug t)

and run M-x indium-connect
I get

Sent: ((id . 10) (type . configurations) (payload (action . list) (directory . /foo/)))

Received: ((id . 10) (type . success) (payload . [((name . projet) (type . chrome) (url . http://127.0.0.1:8080/basic.html) (port . 8080) (projectFile . /foo/.indium.json) (resolvedRoot . /foo))]))

Sent: ((id . 11) (type . connection) (payload (action . connect) (directory . /foo/) (name . projet)))

Received: ((id . 11) (type . error) (payload (error . <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>Error response</title>
    </head>
    <body>
        <h1>Error response</h1>
        <p>Error code: 404</p>
        <p>Message: File not found.</p>
        <p>Error code explanation: HTTPStatus.NOT_FOUND - Nothing matches the given URI.</p>
    </body>
</html>
)))

the http server log a not found file "GET /json/list HTTP/1.1" 404 -

@NicolasPetton
Copy link
Owner

This is probably a very dum question but I'm unsure. Should the web server be started, or is it part of what indium will start ?

Indium will start it for you.

and run M-x indium-connect

Try executing M-x indium-launch instead to launch chrome and connect to the process.

{
"configurations": [
{
"name": "projet",
"type": "chrome",
"url": "http://localhost:8080/basic.html",
"port": "8080"
}
]
}

The "port" option is wrong, in your case you should simply remove it. It is used to specify the port to connect to the chrome debug protocol, not the port of your server.

A working configuration would look like:

{
    "configurations": [
	{
	    "name": "projet",
	    "type": "chrome",
	    "url": "http://localhost:8080/basic.html",
	}
    ]
}

@maliky
Copy link
Author

maliky commented Jun 3, 2019

OK, thank you... very much. I'm getting there.

  • open emacs
  • navigate to your .indium.json root floder
  • and juste M-x indium-lauch
    This open the *JS REPL* and it's better than the inspector console for my basic.html file.

But question.
Why don't I need M-x indium-connect ? I don't have any chrome-browse process running before doing the launch.

@NicolasPetton
Copy link
Owner

NicolasPetton commented Jun 4, 2019 via email

@maliky
Copy link
Author

maliky commented Jun 6, 2019

Thank you.

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

No branches or pull requests

2 participants