My node.js code in running in VS code but not showing any output in terminal, it is only showing 'code is already running' - node.js

Here is the image of my vs code and the code what I've written

The problem is that you are running your code with an extension and are trying to find the output in the terminal where you did not start the program.
Click on the drop-down menu in the nav-bar above your terminal where it says "powershell" and try switching terminals to see which one shows the output.
Try exploring the different tabs in the nav-bar as well, especially the Output tab.
(This should be a comment but unfortunately I do not have enough reputation to comment)

Related

VS Code input and variables don't show frequently in Interactive window

I have started using VS Code for work instead of Anaconda and there are some weird observations which I am not able to figure out.
If I try to execute some code in a cell in the interactive window, many-a-times, only output remains available and the input code automatically gets hidden. For eg. I type the following and execute:-
And this is what I see at the window:-
Similarly, there are some variables which I have already defined but they don't show up in the Jupyer:Variables tab. For eg. there is a variable _link_name_to_index which is not visible in the tab as shown below:-
However, when I execute the same in the window, I can see the values of the dictionary as expected:-
Maybe it is just a matter of some settings, but I still couldn't find out which one. Also, I know I have put a lot of images, because it is not a code doubt as such, rather more of a tool doubt. I have taken only one particular example here, but I face this issue often. I am using VS Code version 1.75.0 in Ubuntu 20.04, using Python 3.9.12 in a virtual environment, if it helps.
This is a bug in the latest Version of VSCode (1.75). It is tracked in this issue. For now, the only option seems to be downgrading to v1.74.x

Compiling pascal program in Visual Studio Code for Linux

Recently, I switched my OS to Ubuntu. I just started with collage and I have to learn pascal for my finals. But a problem occurred.
I installed Visual Studio Code and Pascal extension for it, but I am unable to run even a simple Hello World code. I wrote code, it saved automatically as .pas, but when I enter debug & run option in VSC it displays a message that says 'Open a file which can be debugged or run.', followed by 'debug' and 'run' buttons that I am unable to click and another message that says 'To further configure Debug and Run create a launch.json file.'
I am not even sure am I supposed to post questions such as this one on stackoverflow, but I sincerelly hope that someone could give me a hint on what to do. Solve this within Visual Studio Code or switch to another IDE (and which one would you recommend for Linux user) and pretend that nothing happened?
Thanks in advance.
I know this isn't an answer to "how to debug with pascal with vscode" but, perhaps you would find it easier to just use FPC / Lazarus (IDE) to do your work. While it doesn't have a dark theme, contrary to popular belief, that's not necessary to program.
The IDE is feature packed and allows for full code completion, debugging, etc... (everything you really need to do the work for school).
Additionally, you can use this open source tool to install everything you need for your platform in just a few button clicks (also allows for installing common library packages)
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases
download release for your OS
under "FPC Version" & "Lazarus Version" select trunkgit (or stable for an older version)
click the "Install/Update FPC + Lazarus" button
Have you Installed Pascal extension which is available for code to smoothly run pascal code.
If you haven't then try installing this extension using,
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
ext install alefragnani.pascal
You can always check,
https://marketplace.visualstudio.com/items?itemName=alefragnani.pascal
to install and configure pascal in vscode.
I will direct you to the debugging page from the Visual Studio Code documentation that details how to use the debugger and configure a launch.json file. VSCode is a generic IDE so you need to give it some information about your project before it knows how to run the debugger. This is what launch.json is for.
If I could make a suggestion. When you're learning how to program, it's best to start with the basics. Write a small program in a text editor (VSCode is fine, or Vim, or Nano, or Notepad, or whatever). Save the file. Compile and run the program on the command line.
Once you put an IDE in the mix, you have to learn how to use that as well. If you're stuck on both parts, it can be hard to make progress. That said, it's good to learn how to use the IDE, and you should spend some time reading the documentation and working through some of the examples. It takes some time, but it will pay you back a thousand times when you can work more quickly.

How do I get npm to run in terminal?

I'm tasked with creating a simple calculator application for entry to a programming course. I'm having issues with Terminal :(
I'm not looking for an answer to my overall task, I just want to know why Terminal wont RUN!! What am I doing wrong?
Steps as follows:
Create a directory that you will keep your Calculator application in. Call it
something sensible, like "Calculator".
Open up a command prompt and navigate to your calculator directory
Run npm init to create a new Node.js project. Use the default answer to every
question it asks you (just press "Enter") - don't worry if you don't understand
what all the questions mean!
If it doesn't do anything after the final question "Is this ok?", double-check
there's a file in the folder called package.json . If it's there, everything went
smoothly and you can exit the npm init process by typing in the console
Ctrl + C .
So my problem is... when I run npm, all that happens is my Mac asks if Terminal can access or change files in my system, I click yes, then Terminal doesn't do anything from there, no questions etc I just get:
I can't see package.json, so I take it it hasn't worked properly? How can I fix this to move on?
I'm using zsh on terminal.
Well, first off. What ide do you use? (Personally I like Visual Studio Code).
I'm not sure what the short command is for you to open up the terminal but just google it. Otherwise, you can click "Terminal" on the very top and open a new terminal.
When you do this, you will get a new window at the bottom of your screen. This window has some tabs, make sure you are in the terminal tab.
While there, type "npm init".
This will give you your package.json-file.
If you want to use your terminal for outputs I recommend you get nodejs too.

How to run Selected Text using activate.bat instead of ps1 in Visual Studio Code?

Running into this weird issue and I don't seem to be able to find a solution online or forums. My VS Code was working fine last night, but this morning when I launched VS Code and trying to execute code (in Python) using the Run Selected Text feature, I kept getting "& "C:/Users/jiejenn/Documents/Python Venv/vtest2/Scripts/activate.ps1"
& was unexpected at this time." error message.
In the past, VS Code is using the activate.bat file, which is what I want, but all of sudden, PowerShell took over the command. I am trying to revert back to using the activate.bat file instead of activate.ps1.
Can anyone provide me with some guidance how can it be done? Thanks.
I have already Googled for the past 2 hours, haven't find any solution that solves the issue.
It sounds like your default terminal application changed from cmd to PowerShell, possibly during an update. Click the terminal dropdown button and then Select Default Profile to change it back to cmd.
See also this related issue.

Python code terminated in Pycharm with exit code 1073741819

Python version: 3.4
Hi, I was running a small Python code in Pycharm, but it was terminated with the exit code 1073741819.
I've tried the same code in the Python command line and Anaconda, and both worked. Any idea why Pycharm has the problem, and how can I get it work in Pycharm? Thanks a lot.
Its too late to answer now, but maybe it helps someone else. My code also worked right with command line but not inside pycharm, it usually happens when we switch between different projects on PyCharm.
I fixed it by:
1- Restarting the Pycharm and reloading the project into it.
2- Clearing the heap memory by clicking at this in status bar:
and now it works pretty fine.
P.S: If this indicator doesnt appear then visibility of this section in the Status bar is defined by the Show memory indicator check box in the Appearance page of the Settings/Preferences dialog. It is not shown by default.

Resources