In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the method of running scripts with nodejs". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "what is the method of running scripts with nodejs" together!
Operation method: 1. Open cmd command window, execute "node" command to enter node editing mode, enter js script code, and enter to run. 2. Write the js script code into the js file and execute "node js file path" in the cmd command window.
Operating environment for this tutorial: Windows 7 system, nodejs version 12.19.0, Dell G3 computer.
How to run scripts with nodejs:
1. Execute a separate JS code script with node
First enter the node command in the console to enter node code execution and edit mode, as follows, an arrow and input cursor will be displayed
At this time, as long as you enter a separate js code at this cursor, as shown below, I casually executed some javascript code.
[Note that I have heard that the way to enter node mode to execute JS code is to execute JS code line by line, but not to execute a JS file]
2. Execute the entire JS script file with node
If you want to use node to directly execute an entire nodejs file, then you cannot enter the node edit mode, but you should enter the node js file name directly in the command box.
As follows:
node hello or node hello.js
For js files that follow node, the.js suffix may or may not be added. (Note: If the js file is not in the directory where the current command box is located, you need to locate the command box to the corresponding directory first, or add the specific path of the js file name after the node)
Thank you for reading, the above is the content of "what is the method of running scripts with nodejs", after learning this article, I believe that everyone has a deeper understanding of what is the method of running scripts with nodejs, and the specific use needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.