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

[1.4.2] While debugging server, node-inspector debug console is unusable #7991

Closed
brucejo75 opened this issue Oct 29, 2016 · 36 comments
Closed

Comments

@brucejo75
Copy link
Contributor

brucejo75 commented Oct 29, 2016

EDIT by @abernix: This is a node-inspector bug see this workaround provided by @AronVanAmmers below!.

This is new with 1.4.2: I am seeing this error when loading a server debug session

Network.loadResourceForFrontend failed.
Error: ENOENT: no such file or directory, open 'E:\mroot\meris\.meteor\local\build\programs\server\profile.js.map'

I do not know if it is related, but any commands in the console get lost in space (I assume the debugger may be parsing the entire symbol tree looking for things?). The console is unusable.

This may be related to #7977

Environment

Windows 10: 1511 (OS Build 10586.633)
Meteor: 1.4.2
Chrome: 54.0.2840.71

@brucejo75 brucejo75 changed the title [1.4.2] While debugging server, console is unusable [1.4.2] While debugging server, debug console is unusable Oct 29, 2016
@akodate
Copy link

akodate commented Nov 1, 2016

I am also getting this exact same error after the 1.4.2 update.

@aaroncalderon
Copy link

I am experiencing the same issue.

Environment

Windows 7
Meteor: 1.4.2
Chrome: 54.0.2840.71

@benjamn
Copy link
Contributor

benjamn commented Nov 7, 2016

What "debug console" are you talking about? Do you mean meteor shell or meteor debug or something else? I'm confused about why you'd be using Chrome to debug server code.

@aaroncalderon
Copy link

@benjamn I believe he is refering to using meteor debug and then opening the http://localhost:8080/debug?port=5656. Then once chrome loads the page the above mentioned error happens and the console is unusable.

That is what happens to me.

@brucejo75
Copy link
Contributor Author

Sorry. I am using node-inspector which pops up a chrome window.

This error shows up in the console window of Node-inspector:

Network.loadResourceForFrontend failed.
Error: ENOENT: no such file or directory, open 'E:\mroot\meris\.meteor\local\build\programs\server\profile.js.map'

And the console is unusable. If I type in a variable to inspect it simply does not work. This is impacting debugging fairly significantly.

@brucejo75 brucejo75 changed the title [1.4.2] While debugging server, debug console is unusable [1.4.2] While debugging server, node-inspector debug console is unusable Nov 8, 2016
@brucejo75
Copy link
Contributor Author

@benjaminn: Does profile.js need to be in this list?

@benjamn
Copy link
Contributor

benjamn commented Nov 8, 2016

@brucejo75 it gets written just above that list (builder.write("profile.js", ...))

@benjamn
Copy link
Contributor

benjamn commented Nov 8, 2016

For what it's worth, we are using the latest version of https://www.npmjs.com/package/node-inspector (0.12.8).

@brucejo75
Copy link
Contributor Author

Yeah, I upgraded everything. But the console is still dead.

Any idea why Node-inspector is looking for the map of profile.js? Does not seem to need or complain about lack of maps for any other .js files in that directory: .meteor\local\build\programs\server

@brucejo75
Copy link
Contributor Author

brucejo75 commented Nov 9, 2016

I just installed 1.4.2.1 and verified the issue is still there in that version.

Repro

  1. meteor create test
  2. cd test; meteor
  3. Bring up node-inspector

Result

  • Error message on console:
Network.loadResourceForFrontend failed.
Error: ENOENT: no such file or directory, open 'E:\mroot\meris\.meteor\local\build\programs\server\profile.js.map'
  • node-inspector console is not responsive to commands

@brucejo75
Copy link
Contributor Author

OK, I found this: node-inspector/node-inspector#903

Seems that node-inspector is having a sync problem with Chrome and this bug cropped up with new versions of Chrome. Not related to Meteor...

Closing, sorry for the distraction.

@benjamn
Copy link
Contributor

benjamn commented Nov 10, 2016

All good! Obviously node-inspector is a large and complicated piece of software (mimicking Chrome DevTools with pure HTML is no easy feat!), and so the surface area for bugs is pretty big. On top of that, the Chrome team isn't directly responsible for node-inspector continuing to work with their updates, so there are bound to be bugs like this one from time to time. Thanks for digging into it some more.

@AronVanAmmers
Copy link

AronVanAmmers commented Dec 9, 2016

Note that this issue describes three phenomena:

  1. node-inspector for a meteor app doesn't show the source tree
  2. An error message about profile.js.map is shown in the error console of the Chrome tab that node-inspector is loaded in
  3. The console of node-inspector doesn't work due to a change in handling keyboard inputs in Chrome

Point 3 is indeed a generic issue between node-inspector and Chrome. Getting your hands on a Chrome version 51 or earlier is a workaround for this point.

Point 1 and 2 are connected and actually do only occur after Meteor 1.4.2. I've tested Meteor 1.4.1.3 and there the source tree loads fine and there is no error message about profile.js.map. So there does seem to be something wrong on the Meteor side as well.

@abernix
Copy link
Contributor

abernix commented Dec 12, 2016

@AronVanAmmers First, please try resetting your dev environment with meteor reset (will clear your database too!). If you continue to experience this, please open a new issue (this is closed) with steps on how to reproduce the exact problem you're encountering (most preferably with a Git reproduction repository which can be cloned!). From my own perspective on this issue, in the course of triaging GitHub issues for Meteor, I routinely use meteor debug and node-inspector in various capacities on many different apps and have not encountered problems that you're referring to.

@AronVanAmmers
Copy link

@abernix that's encouraging, thanks 😄. Will clean up and report back.

@brucejo75
Copy link
Contributor Author

BTW: I do not think node-inspector will ever get fixed anymore.

As of Node v6.3.0+, node applications can be debugged with the chrome debug tools directly:

See "Debugging Node.js with Chrome DevTools"

YAY! Looking forward to the next version of Meteor with support for Node v6. I think it is coming soon.

@AronVanAmmers
Copy link

@brucejo75 thanks, that's very helpful to know! Looking forward to v6.

As it turns out, I was wrong on point 1 above. Indeed loading the source tree works fine in 1.4.2.3, as does the rest of the debugging functionality. The error message about profile.js.map is shown using the repro steps above, however it doesn't seem to cause any harm.

@AronVanAmmers
Copy link

AronVanAmmers commented Dec 13, 2016

Here's a one-liner to apply the workaround from node-inspector/node-inspector#951 and fix the behaviour of the enter key in Chrome >= 53. This adapts the file of node-inspector within the meteor path. This needs to be run after every new Meteor version update.

find ~/.meteor -name DOMExtension.js -exec sed -i 's/return event.keyCode !== 229 \&\& event.keyIdentifier === "Enter"\;/return (event.keyCode !== 229 \&\& event.keyIdentifier === "Enter") || event.keyCode === 13\;/g' {} +

Note that there appears to be an issue with the cursor keys as well, and node-inspector has more issues. But with this fix basic debugging is possible.

UPDATE: the original version of this message was missing some characters at the end, sorry about that!

@mikepaszkiewicz
Copy link

mikepaszkiewicz commented Dec 13, 2016

@AronVanAmmers - tried running from terminal and it acted like I was missing a quote or something, so i modified the file directly:

  1. find ~/.meteor -name DOMExtension.js
  2. open file and find isEnterKey
  3. replace function with one given here node-inspector can't console in nodev6.2.1 , Enter no reaction node-inspector/node-inspector#951
function isEnterKey(event) {
//suit for event.keyIdentifier
return (event.keyCode !== 229 && event.keyIdentifier === "Enter") || event.keyCode === 13;
}

@brucejo75
Copy link
Contributor Author

Thanks for the pointer, but that fix does not work for me. I did these steps:

  1. Made the change in the file
  2. Did a rebuild.
  3. Opened up node inspector by going to: http://127.0.0.1:8080/?port=5858 in my browser
  4. Hit a breakpoint

Went to a console line I still have the enter problem?

@mikepaszkiewicz
Copy link

mikepaszkiewicz commented Dec 13, 2016

@brucejo75 Hm..by rebuild do you mean letting the project auto-rebuild after a change or completely stopping the app and running meteor again? I had to do the latter to get it working.

Also double check that your project is running on the same meteor release as the subdirectory of the file you changed. I have two meteor version directories for different projects - 1.3.3 & 1.4.2.1 - and had to make the change in both.

@brucejo75
Copy link
Contributor Author

@mikepaszkiewicz, thanks for the reply. I am seeing a problem, maybe with my build?

  1. I stopped the app and reran meteor.
  2. I only have one DOMExtension.js file under my .meteor directory and it was found here:
    .meteor\local\dev_bundle\lib\node_modules\node-inspector\front-end\platform.
  3. I am running meteor v1.4.2.3

And here is the code in the file I changed:

/**
 * @return {boolean}
 */
function isEnterKey(event) {
    // Check if in IME.
    return (event.keyCode !== 229 && event.keyIdentifier === "Enter") || event.keyCode === 13;
}

While running node-inspector, I hit F12 and took at look at platform/DOMExtension.js and it does not have the change in it that I added above. I would have thought a rebuild would have pulled this in? Maybe with the smarter build it is skipping the dev_bundle rebuild?

Also, how do you fire up a debug session? Just navigate to http://127.0.0.1:8080/?port=5858?
Thanks

@AronVanAmmers
Copy link

@brucejo75 @mikepaszkiewicz there was a typo in my initial message about the one-liner. Corrected, sorry about that.

I can confirm that breakpoints work for me. Indeed start by navigating to http://localhost:8080/?port=5858.

@ajitgoel
Copy link

ajitgoel commented Feb 4, 2017

@AronVanAmmers : I made the changes as suggested by @brucejo75 on Dec 13, 2016 and I am still getting the same issue. Any ideas on what I might be doing wrong?

@brucejo75
Copy link
Contributor Author

@ajitgoel I figured out my issue. I had installed node-inspector globally, not in my meteor project.

So I made the requisite changes in the global repository for node-inspector. In my case that is on windows and my installation is here: C:\Users\Bruce\AppData\Roaming\npm\node_modules\node-inspector.

Maybe others got tripped up by this too?

@ajitgoel
Copy link

ajitgoel commented Feb 5, 2017

Hi @brucejo75,
I am a meteor newbie.
The project that I am working on is located in C:\Projects\simple-todos folder.
I made the changes suggested in your comments in the C:\Users\u6041471\AppData\Local.meteor\packages\meteor-tool\1.4.2_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules\node-inspector\front-end\platform\DOMExtension.js
file whereas the node-inspector folder is present in C:\Users\u6041471\AppData\Local.meteor\packages\meteor-tool\1.4.2_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules.
This however did not solve the problem. Can you please help?

@brucejo75
Copy link
Contributor Author

What happens when you type where node-debug and where node-inspector to the command line of a cmd window?

@ajitgoel
Copy link

ajitgoel commented Feb 6, 2017

I get the following when I run the where node-debug and where node-inspector commands respectively.
C:\Users\u6041471\AppData\Roaming\npm\node-debug
C:\Users\u6041471\AppData\Roaming\npm\node-debug.cmd

C:\Users\u6041471\AppData\Roaming\npm\node-inspector
C:\Users\u6041471\AppData\Roaming\npm\node-inspector.cmd

When I run the npm install -g node-inspector command, I see the following error:

23885 verbose stack Error: v8-debug@0.7.7 install: node-pre-gyp install --fallback-to-build
23885 verbose stack Exit status 1
23885 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16)
23885 verbose stack at emitTwo (events.js:106:13)
23885 verbose stack at EventEmitter.emit (events.js:191:7)
23885 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
23885 verbose stack at emitTwo (events.js:106:13)
23885 verbose stack at ChildProcess.emit (events.js:191:7)
23885 verbose stack at maybeClose (internal/child_process.js:885:16)
23885 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
23886 verbose pkgid v8-debug@0.7.7
23887 verbose cwd c:\Projects\simple-todos
23888 error Windows_NT 6.1.7601
23889 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "node-inspector"
23890 error node v7.4.0
23891 error npm v4.0.5
23892 error code ELIFECYCLE
23893 error v8-debug@0.7.7 install: node-pre-gyp install --fallback-to-build
23893 error Exit status 1
23894 error Failed at the v8-debug@0.7.7 install script 'node-pre-gyp install --fallback-to-build'.
23894 error Make sure you have the latest version of node.js and npm installed.
23894 error If you do, this is most likely a problem with the v8-debug package,
23894 error not with npm itself.
23894 error Tell the author that this fails on your system:
23894 error node-pre-gyp install --fallback-to-build
23894 error You can get information on how to open an issue for this project with:
23894 error npm bugs v8-debug
23894 error Or if that isn't available, you can get their info via:
23894 error npm owner ls v8-debug
23894 error There is likely additional logging output above.
23895 verbose exit [ 1, true ]

@brucejo75
Copy link
Contributor Author

brucejo75 commented Feb 7, 2017

OK, good information. Couple of things:

  1. I am running the same version of Node as the version inside of Meteor. I am running meteor v1.4.2.3, which is running node v4.6.2. I recommend that you do the same. You can find this out by running these commands:
meteor --version
meteor node -v
  1. You need to figure out what is going on with the node-inspector install. It looks like there is an open bug on it and an answer here. From reading this, I think it may be node version 5+ related. So if you go back to node v4.6.2 I think it may install without issue.

  2. Also there is another gotcha. I initially installed 64 bit versions of node and node-inspector. But meteor only supports 32 bit. So it all must be installed 32 bit to properly mate with the meteor app.

After all that...

Now you can make the patch to node-inspector here: C:\Users\u6041471\AppData\Roaming\npm\node_modules\node-inspector\front-end\platform\DOMExtension.js

Hope this helps.
@ajitgoel, let me know if this worked...

@avishaan
Copy link
Contributor

avishaan commented Mar 8, 2017

I'm glad this thread is here but this is nuts that it has been an issue almost for 5 months. I guess either no one is debugging their apps or maybe many people aren't using Meteor? Is there an alternative debugging method that everyone is using other than meteor shell ?

@abernix
Copy link
Contributor

abernix commented Mar 8, 2017

@codehatcher This issue is closed. Meteor apps can be debugged by running meteor debug and I do this on a regular basis. If you encounter problems with using those debug tools, please open a new issue with a reproduction.

Edit: You really shouldn't need to install node-inspector globally, or within Meteor or anything like that; meteor debug should be enough.

@avishaan
Copy link
Contributor

avishaan commented Mar 8, 2017

@abernix what was the solution that closes this issue that I also see. The highly reacted ones are the "hacks" vs official fix

@abernix
Copy link
Contributor

abernix commented Mar 8, 2017

@codehatcher I guess the resolution was that there is a bug in node-inspector's console (the bug is still open). But that doesn't mean that people aren't debugging their apps or not using Meteor, it just means that developers aren't using the console in node-inspector.

The reproduction above still appears a bit incorrect as it doesn't show any attaching of Meteor to the debug interface – or more correctly, using meteor debug at all – which doesn't require you use node-inspector directly at all.

But again, if you're encountering this problem, can you please open a new issue with a clear reproduction? 😄

@brucejo75
Copy link
Contributor Author

repro using meteor debug is here.

Regardless there is no bug in Meteor. Node-inspector had a bug and a published workaround here..

After closing the bug, this thread published instructions on how to patch your version of meteor's node-inspector. Those instructions did not work for me. Then I realized that my debug environment uses my installed version of node-inspector and I do not use the version that comes with Meteor so I published instructions on how to find the file to patch for that circumstance.

@abernix is right, I am confusing things by not using meteor debug which is the documented way to debug. I hadn't realized it was confusing because I never figured out how to debug meteor any way other than what I happened to cobble together.

hmm. thinking about it... would it be reasonable for Meteor to apply the patch as part of building the dev bundle?

@avishaan
Copy link
Contributor

avishaan commented Mar 8, 2017

I'll open up a new issue, I am having the same issue as the person that posted in November but it seems that's buried in the comments

@abernix
Copy link
Contributor

abernix commented Mar 9, 2017

The bug reported in bullet-point 3 in December is actually the same as the original issue and the subject of this issue.

This is absolutely a bug with node-inspector and I can reproduce it myself now too. We'll follow the node-inspector fix for this in your new issue, but it is essentially a duplicate and the same problem is experienced in node-inspector outside Meteor and will (eventually?) be fixed if/when node-inspector lands node-inspector/node-inspector#955 and is reported in node-inspector/node-inspector#903.

@meteor meteor locked and limited conversation to collaborators Mar 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants