My VS CODE extension code runner isnt working - javascript

Hi my issue is that in my visual studio code, my code runner extension doesn't provide any output. I've looked at a bunch of tutorials and have done everything, research, download node.js,and saves the file as a javascript file and verify paths.
I entered " console.log("Hello")
Its prints this out
[Running] node "c:\Users\NAME\Untitled-1.js
[Done] exited with code=0 in 0.202 seconds
And nothing
Please help idk what I'm doing wrong 😭

Looks like you haven't saved the file.
Try saving the file and then run with Code Runner.
Tip: You can enable Save before Run settings so that it gets saved every time before running the file.
File -> Preferences -> Extensions -> Run Code Configuration -> Save File Before Run

I recommend you to run node -v and npm -v in command prompt window to see if you have them installed
the output must be like this
C:\Users\Anonymous>node -v
v16.14.0
C:\Users\Anonymous>npm -v
8.3.1
and if there is a problem it might be from your paths ("Edit system environment variables" in windows search) or you haven't installed npm or node.

in my case solution was to uncheck "Show Execution Message" check box in Run Code configuration.
setting
result

Related

Deno not recognised in VS Code's Terminal

I'm sorry, I got this trouble on my VS Code terminal, Deno isn't recognized:
But when I try to do it in my Windows command prompt in the exact same path, it works:
Any idea how to fix that?
I'm not sure how you installed Deno, but I am assuming you did it using Windows Command while your VS Code was running, therefore it have a different terminal session.
If that's the case the VS Code terminal won't find the deno executable because it is a different session and it needs load from the PATH again.
Restart VS Code and see what happens.
If you want to be sure print the PATH variable and confirm that deno is in there.
echo %PATH%
Checkout deno_install for more installation options.
I personally like to use Choco to managed my Windows packages (I thought I run mostly WSL).
choco install deno

How to Run JavaScript file with node.js on windows (scribbletune)

Is it possible to run a JavaScript file with node.js on windows? I have been trying to for hours and can't find any more solutions on the internet that work.
I have a js-file that uses scribbletune which only works with node.js.
I have node.js installed and I installed gitbash because it was recommended in a forum.
I tried to run from command prompt and gitbash but nothing seems to happen.
What am I doing wrong? Any help would be very much appreciated.
There is no need to install gitbash to use Node on Windows. It's a handy thing to have if you're used to a *nix environment. If you're not, it just gives you something more to learn, which isn't helpful if you're already in the middle of trying to learn Node.
Just:
Get the Windows installer from https://nodejs.org/en/download/
Run the Windows installer
Create a directory for your project
Open a Command Prompt Window to get a command line
Switch to your project directory
(Optional, but a good idea) Use npm init to create a package.json file (it'll walk you through it)
Install any libs you're going to be using via npm (for instance, npm install scribbletune from your command prompt window)
Put your JavaScript files in that directory
Use node main.js at the command line to run your main file (whatever it's called; main.js is just a placeholder)
Inorder to run a js (java script file) file
step 1. u need to go to the file location where u want to run.
step 2. just use "shift +right click".
u will see a pop-up and go to powershell or cmd.
step 3. type "node FILENAME.js"
final step: you will see the result ^.^

npm not installing returns error consistently

I was trying to install this : Search git whodotheyserve. com but this error shows up consistently .No matter what i try. I have tried other version of npm they are installed but the
npm test
error shows up .
npm run-script task
too returns error
This happens consistently .Also i am following each step mentioned in source of this project.Image attached.Please help where am i wrong here. The file extension used here ls .I had no experience with these. Image link
Echo %PATH% image link
The build fails because you are using Windows instead of Linux.
This is clearly stated in the installation instructions you claim to have followed in your duplicate question.
notes
The build tasks rely on Linux shell commands such as pkill and rsync
so are unlikely to run on other OS's without some tweaks.
If you want to run this under windows, you should ask the repo maintainer for guidance.
You have to install python 2.7 and make sure it's in your PATH variable.
Try:
set PATH=%PATH%;C:\python2.7\python.exe
Replace C:\python2.7\python.exe with your actual python installation path
The issue here was that this was made to run on linux only.So ,it won't run on windows on which i was trying to run it.The issue arose as i was trying to install it on wrong OS.I have successfully installed it on linux.It works great.
I want to thank all those who contributed in helping me with this issue.Thanks a lot to all those who helped.

Node.js execute Javascript file

This is a completely newbie question and I'm sure the solution is very easy but I don't get it.
I downloaded Node.js and put the command-tool file and the npm in my project file.
I created a file called example.js which contains
console.log("hello world");
Now I open the node file and type in
node example.js
And it shows me unexpected Identifier.
Thanks in advance.
Edit:
node -v
Shows node is not defined ?? ..
I'm slightly confused.
Edit2: MAC IOS
Edit3: I installed it and the path was usr/local/bin am I allowed to just move the file?
Edit4: Thanks node -v works now. I opened it through the cmd tool
Edit5: okay now everything works.. I thought I have to work with the node cmd tool. Thanks for the quick help!
Open terminal
Go to the folder you have your example.js (use cd-command)
type in terminal node example.js, press enter
You should not RUN node before typing node example.js

beefy command not found

I am new to node.js and trying to follow this tutorial. I am getting an error on the last command beefy game.js:bundle.js --live. It says sh.exe": beefy: command not found
The beefy package version I am using is 2.1.1
Tried to Google this problem but couldn't find a solution.
I have not followed the tutorial in detail, but the response form the console means that the the console command or program called beefy is not installed. The first word of your input into the console will be interpreted to be a command (a little program) that will run.
For instance cd is a program to change directory and the next thing you enter will specify a directory to which to change.
beefy is not a command/console program that is in your system. (It is not a standard command.) Probably somewhere else in the tutorial you were instructed to install it in one of your various bin/ directories (where shell program commands are stored.)
EDIT:
TL;DR
The fix: install beefy globally (on your machine not for directory only) using npm:
npm install beefy --global

Categories