简体   繁体   中英

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:

  1. Get the Windows installer from https://nodejs.org/en/download/

  2. Run the Windows installer

  3. Create a directory for your project

  4. Open a Command Prompt Window to get a command line

  5. Switch to your project directory

  6. (Optional, but a good idea) Use npm init to create a package.json file (it'll walk you through it)

  7. Install any libs you're going to be using via npm (for instance, npm install scribbletune from your command prompt window)

  8. Put your JavaScript files in that directory

  9. 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 ^.^

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM