Skip to content

Nodejs 8 - Cannot debug JavaScript via Node.JS (Failed to connect to Standalone V8 VM) #77

Open
@rajivkanaujia

Description

@rajivkanaujia

First issue is that there is some default setting that is still using --debug and --debug-brk
When I run my simple app, it works. When I try to debug, I get an error on Console

(node:4376) [DEP0062] DeprecationWarning: node --debug and node --debug-brk are invalid. Please use node --inspect or node --inspect-brk instead.

The next step was to force --inspect or --inspect-brk via Preference ---> Nodeclipse. This still does not work.

My js file is simple

var http = require("http");
// create a http server that writes hello world
http.createServer(function(request, response) {
	// Send the HTTP header 
	// HTTP Status: 200 : OK
	// Content Type: text/plain
	response.writeHead(200, {
		'Content-Type' : 'text/plain'
	});

	// Send the response body as "Hello World"
	response.end('Hello World\n');
}).listen(8081);

//Console will print the message
console.log('Server running at http://127.0.0.1:8081/');

When I try to debug this as a Node Application, I get following at Eclipse Console

Debugger listening on ws://127.0.0.1:5858/b1bdf38d-c53a-472d-89f8-6819c5e4c8b1 For help see https://nodejs.org/en/docs/inspector

But then V8 fails. I am not sure where I need to make the changes. Below is the error I get.

Nodeclipse/chromedevtools failed to connect to Standalone V8 VM ( Check Help (F1) and Support http://www.nodeclipse.org/#support ) . Info: Timed out waiting for handshake

I am using Node: v8.1.0 and Eclipse Version: Neon.3 Release (4.6.3) Build id: 20170314-1500

Any suggestions?

See - Nodeclipse/nodeclipse#107

Is there a need for V8 Inspector Protocol for Eclipse?

Output from log file

$ /Applications/Eclipse.app/Contents/MacOS/eclipse -consoleLog
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized.  Will retry after the state location is initialized.
org.eclipse.m2e.logback.configuration: Logback config file: /Users/rajiv/Development/workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.7.0.20160603-1933.xml
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://1083.fwk1529457505:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://1083.fwk1529457505:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
org.eclipse.m2e.logback.configuration: Initializing logback
!SESSION 2017-06-13 19:15:28.458 -----------------------------------------------
eclipse.buildId=4.6.3.M20170301-0400
java.version=1.8.0_60
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -consoleLog

!ENTRY org.eclipse.core.net 1 0 2017-06-13 19:15:37.097
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences

!ENTRY org.eclipse.jface 2 0 2017-06-13 19:15:40.031
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2017-06-13 19:15:40.031
!MESSAGE A conflict occurred for ALT+COMMAND+C:
Binding(ALT+COMMAND+C,
	ParameterizedCommand(Command(de.bastiankrol.startexplorer.copyResourcePathToClipboardFromResourceView,Copy Resource Path to Clipboard,
		Copies the path of the resource to the clipboard,
		Category(de.bastiankrol.startexplorer.commands.category,StartExplorer,null,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@2c914364,
		,,true),null),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,,system)
Binding(ALT+COMMAND+C,
	ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text.java.modify.method.parameters,Change Method Signature,
		Change method signature includes parameter names and parameter order,
		Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@25c756f0,
		,,true),null),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,cocoa,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2017-06-13 19:15:40.032
!MESSAGE A conflict occurred for ALT+COMMAND+Q P:
Binding(ALT+COMMAND+Q P,
	ParameterizedCommand(Command(org.eclipse.php.ui.explorer,PHP Script Explorer,
		Shows the Script Explorer,
		Category(org.eclipse.ui.category.views,Views,Commands for opening views,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@66c9aca2,
		,,true),null),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,cocoa,system)
Binding(ALT+COMMAND+Q P,
	ParameterizedCommand(Command(org.eclipse.ui.views.showView,Show View,
		Shows a particular view,
		Category(org.eclipse.ui.category.views,Views,Commands for opening views,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@18206382,
		[Parameter(org.eclipse.ui.views.showView.viewId,View,null,true), Parameter(org.eclipse.ui.views.showView.secondaryId,Secondary Id,null,true), Parameter(org.eclipse.ui.views.showView.makeFast,As FastView,null,true)],,true),[org.eclipse.core.commands.Parameterization@351c7030]),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,cocoa,system)

!ENTRY org.eclipse.debug.ui 4 120 2017-06-13 19:15:48.152
!MESSAGE org.eclipse.debug.ui.toggleBreakpointsTargetFactory extension failed to load breakpoint toggle target because the specified id is already registered.  Specified ID is: org.chromium.debug.ui.ChromiumToggleBreakpointTargetFactory

!ENTRY org.eclipse.wst.jsdt.chromium.debug.core 1 0 2017-06-13 19:16:03.499
!MESSAGE SDK:org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection: Shutdown requested
Jun 13, 2017 7:16:03 PM org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection$3 shutdown
INFO: Shutdown requested

!ENTRY org.eclipse.wst.jsdt.chromium.debug.core 1 0 2017-06-13 19:16:06.510
!MESSAGE SDK:org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection: Shutdown requested
Jun 13, 2017 7:16:06 PM org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection$3 shutdown
INFO: Shutdown requested

!ENTRY org.eclipse.wst.jsdt.chromium.debug.core 1 0 2017-06-13 19:16:09.515
!MESSAGE SDK:org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection: Shutdown requested
Jun 13, 2017 7:16:09 PM org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection$3 shutdown
INFO: Shutdown requested

!ENTRY org.eclipse.wst.jsdt.chromium.debug.core 1 0 2017-06-13 19:16:12.524
!MESSAGE SDK:org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection: Shutdown requested
Jun 13, 2017 7:16:12 PM org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection$3 shutdown
INFO: Shutdown requested

!ENTRY org.eclipse.wst.jsdt.chromium.debug.core 1 0 2017-06-13 19:16:15.531
!MESSAGE SDK:org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection: Shutdown requested
Jun 13, 2017 7:16:15 PM org.eclipse.wst.jsdt.chromium.internal.transport.SocketConnection$3 shutdown
INFO: Shutdown requested

!ENTRY org.eclipse.wst.jsdt.chromium.debug.core 4 0 2017-06-13 19:16:15.635
!MESSAGE Failed to connect to Standalone V8 VM
!STACK 0
java.io.IOException: Timed out waiting for handshake
	at org.eclipse.wst.jsdt.chromium.internal.v8native.JavascriptVmImpl.newIOException(JavascriptVmImpl.java:114)
	at org.eclipse.wst.jsdt.chromium.internal.standalonev8.StandaloneVmImpl.attachImpl(StandaloneVmImpl.java:134)
	at org.eclipse.wst.jsdt.chromium.internal.standalonev8.StandaloneVmImpl.attach(StandaloneVmImpl.java:79)
	at org.eclipse.wst.jsdt.chromium.debug.core.model.JavascriptVmEmbedderFactory$4$1.attach(JavascriptVmEmbedderFactory.java:207)
	at org.eclipse.wst.jsdt.chromium.debug.core.model.DebugTargetImpl.attach(DebugTargetImpl.java:74)
	at org.eclipse.wst.jsdt.js.node.internal.launch.NodeDebugConnector.attach(NodeDebugConnector.java:118)
	at org.eclipse.wst.jsdt.js.node.internal.launch.NodeLaunchConfigurationDelegate$DebuggerConnectRunnable.run(NodeLaunchConfigurationDelegate.java:179)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.TimeoutException
	at java.util.concurrent.FutureTask.get(FutureTask.java:205)
	at org.eclipse.wst.jsdt.chromium.internal.standalonev8.StandaloneVmImpl.attachImpl(StandaloneVmImpl.java:127)
	... 6 more

How is my project build?

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions