In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-14 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.