简体   繁体   中英

How to run a javascript file with node.js

I have just started learning node.js and i am trying to open a local .js file. The file is stored on desktop and its location is something like C:\\Users\\Jim\\Desktop\\hello.js .

I use the following command:

node C:\\Users\\Jim\\Desktop\\hello.js

Now i use this command but all i get is ... and nothing happens. I have installed node.js and use its own terminal. Other commands also work well without any problem but i am stuck at this very beginning step.

I created a cmd file in nodjs-folder. The cmd-file has only one line:

node %1

Then I told windows to always open js files with this cmd file.

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