I also tried it under window, it was installed perfectly and the test passed!
1. Download node
Download node at https://nodejs.org/en/, I chose the stable version on the left
2. Install node
Install the downloaded node step by step as shown below
3. After installation, check whether the node is successfully installed
After installation, there will be a command window on the window start button
Check the node version after opening it
4. Install global Express
5. Check whether Express is installed successfully
6.demo test
1).Create helloWorld.js
var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World"); response.end(); }).listen(8899); console.log("nodejs start listen 8899 port!");
2). Place helloWorld.js in the F:nodejsnode_modulesnpmtest directory
3). Start output
Use the command line to point to the upper-level directory of helloWorld.js and start express
7.
Run results
Enter http://127.0.0.1:8899 in the browser, the output result is as follows
Author: L'Oréal Paris
The above is the entire content of this article, I hope it will be helpful to everyone’s study.