Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics (2015) The Request and Response Objects in Express Responses and the Response Object

Patrick Harry
Patrick Harry
19,114 Points

Trouble using the console in node-inspector interface.

Here is an example:

  1. I type "console.log('Hello World');" into the console.
  2. I hit "return" on my keyboard (on a Mac).
  3. The cursor moves down a line, and I do not get a console log.

I have this same problem no matter what I type into the console. Meaning, I do not have access to req and res objects form the console.

Is there something wrong with my use of the "return/enter" key? Is this a known issue with node-inspector?

2 Answers

This question is going around heaps on the forums. It looks like node-inspector hasn't been maintained for a while and because of this is having trouble with the latest version of chrome. Ben Myhre posted with great information about the problem (https://teamtreehouse.com/community/nodeinspector-not-working-console-only-going-to-newline-and-not-entering-workaround).

He also later commented with a link to github (https://github.com/node-inspector/node-inspector/issues/951#issuecomment-262441472) where someone has provided code to update an outdated function and fix the issue.

The following was their solution. You will have to use the console to replace the function. The code below uses vim as the editor to do so. (I'm pretty unfamiliar with it but there are plenty resources online to find how to do what you need - http://www.radford.edu/~mhtay/CPSC120/VIM_Editor_Commands.htm).

run:

vi /usr/local/lib/node_modules/node-inspector/front-end/platform/DOMExtension.js

(search for outdated function)

:/isEnterKey

(use dd command to delete lines where the function is)

:dd

(add text on new line)

:o

below is the updated function to add to the file:

function isEnterKey(event) {
//suit for event.keyIdentifier
return (event.keyCode !== 229 && event.keyIdentifier === "Enter") || event.keyCode === 13;
}
evans tsai
evans tsai
3,735 Points

when I run

vi /usr/local/lib/node_modules/node-inspector/front-end/platform/DOMExtension.js  

on terminal, and I found I can't do anything because there was no any text in this file.

I think there may two possible reason why I can't get this file.

  1. I went to the wrong path.
  2. I accidentally delete the file, cuz I am not familiar with the vim.

Do anyone know how to deal with this scenario?

Hey Evans, what version of node-inspector do you have installed?

node-inspector -v