Node's --inspect debugger not showing all source files - node.js

When I debug my script using --inspect, most of the sources show up, but many (seemingly arbitrarily) do not.
Is there any way to get my debugger to load all the source files, or has anyone ran into a similar problem?
Running node 9.1.1
Have tried reinstalling node.
Have tried clearing restoring defaults in the settings of chrome dev tools.
Have tried manually adding folder to workplace, on click nothing happens.

Related

Visual studio code: intellisense not working, showing "initializing JS/TS language feature"

Intellisense isn't working in VSCode. Examples like:
F2 (rename symbol): shows "initializing JS/TS language feature", but stucks forever issue-image
dropdown suggestions not coming up directly, ctrl+enter shows loading, but not getting completed
doesn't show error even in case of genuine error, etc.
Already tried below things:
restarted VScode multiple times
Ctrl+Shift+P > typescript: Restart TS server --> nothing happens
Installed & uninstalled extension (TSLint, JsHint, ESLint)
"Help" -> "check for updates" --> says "there are currently no updates available"
re-ran all command i.e. npm run setup-npm-auth, npm install etc.
tried force build
{verified my solution is getting built properly}
Current versions:
npm: 6.9.0
node: 10.16.3
VScode version
I just had the same issue. Fortunately I was able to fix the problem following this steps from vscode github's comments. You can enable ts language server's log and debug your issue. To enable ts server logging:
Set "typescript.tsserver.trace": "verbose" (Restart vscode)
Reproduce the problem
Open the output panel and view the TypeScript section
In my case my code was referencing to the directory outside of the workspace. So VSCode could never finish the task. I am not sure it's bug or limitation, nevertheless make sure all of your working code is included in your VSCode workspace (or added to working folders). Otherwise it'll stuck like this even code you're referring to exists side by side but not included in your workspace (or visible) in your VSCode.

Node serving an old version but still compiles updates

I'm creating a React application and am running into this issue. When I make changes to code, Node does recompile and even recognizes errors in the code, but no matter what, the localhost in the browser remains unchanged. Here's a list of things that I've tried:
Clearing the browser's cache and hard reloading the page
Switching browsers
Turning Node off and on again
Reinstalling Node
Creating a new directory, copying over the code, and then installing Node there
Turning the whole computer off and on again
I'm not sure what to try anymore. When installing Node, there are no errors, and no errors if I run npm start or npm build. As I said, I know Node is looking in the right directory since it recognizes when I make changes and shows errors when the code fails to compile. I also know I'm looking at the right localhost page since it isn't available when Node isn't running. However, the page remains perfectly usable and unchanged even if the code fails to compile, and actually is able to load before Node compiles all of the code.
I got the code itself from a zip file from GitHub and people who have their frontend set up have no issues with it. Node and all the other dependencies were downloaded by me, again, with no errors.
I'm using Node v10.16.0 and npm v6.9.0

Vue JS Intellij setup

I am working on a Vue js application but am having difficulty getting it to run/debug within IntelliJ. I am currently running it from the command line but I'm interested in getting it to debug in IntelliJ. Not many tutorials out here on getting this set up to work. Is there anyone that has experience in setting up this framework and IDE?
Steps are rather straightforward and described in blogpost:
First, install the JetBrains IDE Support Chrome extension. This will bind the browser debugger environment with IntelliJ in real-time.
start the server with npm serve (can be done from a gutter in package.json):
create a new JavaScript debug configuration, specify the URL your app is running on (usually http://localhost:8080) in it, put the breakpoints right in the source code, and start the debug session.
See also https://blog.jetbrains.com/webstorm/2019/03/get-started-building-apps-with-vue-js-in-webstorm/ for some hints on working with Vue.js in IDEA. And https://medium.com/dailyjs/stop-painful-javascript-debug-and-embrace-intellij-with-source-map-6fe68eda8555
You can add "Run Configuration" for any project to run in Intellij. For this, you must have a run script in package.json.
Refer below link for a screenshot. NPM Run Configuration Sample:
Choose NPM and give like this. Once done, you are all ready for clicking the RUN button available in the toolbar to run the project

Issues with breakpoints in ts-node

I faced a very strange problem. I have two working PC and one of them stop breaking on the breakpoints in one day. Another PC works properly the same as before.
I tried to reinstall Node JS, ts-node and then even hard reset for windows (I use Windows) but without any success.
Then I thought that probably issue in my project and I tried to clone hello world project from google tutorial and I found that I still can't debug with it!
So I successfully run an app on my port but breakpoint won't hit. This stop working in VS Code, in WebStorm and even Chrome debugger.
This is how I run an app: "C:\Program Files\nodejs\node.exe" --inspect --require ts-node/register C:\Projects\node-typescript-starter-master\src\index.ts
Then I opened dev tools from chrome and I see this:
Then I pressed "inspect" and I see message in console:
Debugger attached. Debugger listening on ws://127.0.0.1:9229/8bae9408-867c-4278-9148-b6c90b35a8ae For help, see: https://nodejs.org/en/docs/inspector Debugger attached.
This is the next window. Seems like I missing any files overhere.
Does this mean that something is wrong with my file mapping ?
Please, let me any suggestion what can be a problem.
Well, one of workaround is to don't use ts-node and just use default node js debugger config from WebStorm with adding TypeScript prelaunch compilation script.
Here is a screenshot how to configure:

Webstorm: debugging node.js sails app

I'm having a hard time finding the right combination of settings to allow me to debug my node.js sails application in webstorm.
These are the settings I've tried using, both configurations work (as in sails starts) but none is stopping at breakpoints.
If I go to the breakpoints menu and turn on 'Any exception enabled' - it does stop for exceptions, but never hits my breakpoints.
Any ideas? I'm on webstorm 7.0.1 and Node 0.10.18 / Sails 0.9.7
You don't need the --debug in node parameters. Here is my config and i am on 7.0.1 and node 0.10.4
Let me know if it helped. Also, you are hitting the bug to run debug right?
Also, can you please invalidate caches/ restart? That helps sometimes. Here is a snapshot in the file menu.
I had the same problem and simply installed sails local to the project and everything worked fine. Not sure why the configuration can't resolve the globally installed sails as that is the error I was getting, but the local install works fine. I should investigate further, but I'm lazy :)
When you open a new project on WebStorm, it detects the package.json file and it will ask you to install the dependencies locally. After that, by using the configuration mentioned before (not necessarily by using sails lift but using app.js directly instead), you can debug you application from WebStorm. Another way to do it, is by using this tool, that works like a charm: https://github.com/node-inspector/node-inspector :)

Resources