Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/node_modules
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,26 @@ Tool for getting node-inspector working on windows and for simplifying the proce
- Windows
- [Latest npm build for windows] (http://npmjs.org/doc/README.html#Installing-on-Windows-Experimental)


**Installation**

- From the command window launch install.cmd. This will install node-inspector via npm and apply the paperboy patch described [here] (https://github.com/dannycoates/node-inspector/issues/62#issuecomment-1998429) to get node-inspector working on windows.
- From the start menu right click on Computer->Properties->Advanced Computer Settings->Environment variables.
- Create 2 system variables
- set NODE_INSPECTOR to the folder where this repo is located i.e. "c:\node-inspector"
- set NODE_INSPECTOR_BROWSER to the path of your webkit browser of choice i.e. Chrome, Safari. For example right clicking on Chrome on my machine gives me “C:\Users\gblock\AppData\Local\Google\Chrome\Application\chrome.exe”
- Add %NODE_INSPECTOR% to your path.

**Using**

- node-debug [-c] [-p PORT]
-c will run coffee app.coffee in debug mode otherwise
-p will start node-inspector on the provided port.
- In the command window, go to the folder where the node app you want to debug is.
- Type node-debug [url] e.g. node-debug http://localhost:3000
- Type node-debug

Once you run it from the app folder it will:

- Launch node inspector
- Launch you app in debug mode.
- Open the browser you specified and launch the debugger ui.
- Launch the start url you specified.
- Launch your app in debug mode. (either through `node` or `coffee` depending on the `-c` switch)

**Known issues**
I've seen some cases where running node-debug causes a socket error. This seems to happen periodically. Closing the command windows and starting again seems to clear it.
Expand Down
4 changes: 2 additions & 2 deletions environmentvars.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REM Set environment variables here
REM example: SET MY_VARIABLE=MY_VALUE
@REM Set environment variables here
@REM example: SET MY_VARIABLE=MY_VALUE
42 changes: 33 additions & 9 deletions node-debug.cmd
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
@echo off
start "" "cmd" "/k cd %NODE_INSPECTOR%\node_modules\node-inspector\bin&&node inspector &"
@ECHO off
SET PORT=8080
SET COFFEEDEBUG=0
SET RUNENVBAT=0
IF EXIST "%NODE_INSPECTOR%\environmentvars.bat" SET RUNENVBAT=1

if exist "%NODE_INSPECTOR%\environmentvars.bat" (
start "" "cmd" "/k %NODE_INSPECTOR%\environmentvars.bat&&node --debug-brk app.js"
) else (
start "" "cmd" "/k node --debug-brk app.js"
)
IF "%1"=="" GOTO APPSTART
:GETOPTS
IF /I %1 == -c SET COFFEEDEBUG=1&
IF /I %1 == -p SET PORT=%2& SHIFT
SHIFT
IF NOT (%1)==() GOTO GETOPTS

:APPSTART

start "" %NODE_INSPECTOR_BROWSER% "http://localhost:8080"
echo start "" %NODE_INSPECTOR_BROWSER% "%1%"
START "" "cmd" "/k cd %NODE_INSPECTOR%\node_modules\node-inspector\bin&&node inspector --web-port=%PORT%&"
ECHO started node-inspector on port:%PORT%
IF %COFFEEDEBUG% == 1 IF %RUNENVBAT% == 1 (
START "" "cmd" "/k %NODE_INSPECTOR%\environmentvars.bat&&coffee --nodejs --debug app.coffee"
ECHO applied environmentvars.bat
ECHO started coffee --nodejs --debug app.coffee
)
IF %COFFEEDEBUG% == 1 IF %RUNENVBAT% == 0 (
START "" "cmd" "/k coffee --nodejs --debug app.coffee"
ECHO started coffee --nodejs --debug app.coffee
)
IF %COFFEEDEBUG% == 0 IF %RUNENVBAT% == 1 (
START "" "cmd" "/k %NODE_INSPECTOR%\environmentvars.bat&&node --debug-brk app.js"
ECHO applied environmentvars.bat
ECHO started node --debug-brk app.js
)
IF %COFFEEDEBUG% == 0 IF %RUNENVBAT% == 0 (
START "" "cmd" "/k node --debug-brk app.js"
ECHO started node
)