node-inspector doesn't let me open a specific js file

323 Views Asked by At

When debugging with node-inspector, I can see all of the files in a folder except one. I checked on the filesystem and the .js is there. Ctrl+O doesn't let me select the file as well.

How can I open the file to place a breakpoint? Thanks, PS: I'm using Node Inspector v0.8.0 and node v0.10.33 on a Win7 32 bits

1

There are 1 best solutions below

1
On BEST ANSWER

Node Inspector has two mechanisms for loading files in the GUI.

  1. All files loaded by Node.js (V8) runtime are always listed in the GUI, this works very reliably. The downside is that files not loaded yet are not listed. This typically happens when your application is stared via node-debug or node --debug-brk.

  2. There is a speculative algorithm trying to guess what files are part of your project and included them in the GUI even though they are not loaded in the runtime yet. The algorithm assumes that your project has package.json in the root directory and that the main script file is either in the project root directory (node index.js) or one-level deep (node bin/gpii.js). Additionally, if there is package.json in the current working directory, all javascript files in the current working directory and subdirectories are included too.

See lib/ScriptFileStorage.js for more details.

I suspect that your project is laid out in such way that Node Inspector does not recognise it and thus does not scan it for all javascript files.

You can verify this assumption by running the following code in Node Inspector's Console window while the process is paused, replacing ROOT with the real path to your project root:

require('ROOT/universal/gpii/node_modules/flowManager/src/FlowManager.js')

The file FlowManager.js should appear in Node Inspector after the command has finished.