如何在Xampp本地主机上安装Node.js [英] How to install nodejs on Xampp localhost
问题描述
曾经见过很多关于如何安装Node.js的方法,但是根本不清楚.
Been seeing a lot of how to's on how to install nodejs but nothing is at all clear.
所以我问...
有人可以提供逐步安装指南以在xampp服务器上安装和使用nodejs吗?
Can someone provide a step by step installation guide for installing and using nodejs on a xampp server?
推荐答案
搜索后(源),我发现,直接安装Node.js更容易(因此,需要XAMP/WAMP):
After searching (source), I have found, that it's easier to install Node.js directly (so, need of XAMP/WAMP):
1)安装> http://nodejs.org/download/
1) Install http://nodejs.org/download/
2)创建一个测试文件(示例) C:\ myFolder \ test.js 并将此代码放在该文件中:
2) Create a test file (example) C:\myFolder\test.js and put this code in that file:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
3)打开CMD(命令提示符)并执行:
3) Open CMD (COMMAND PROMPT) and execute:
node C:\myFolder\test.js
4)在浏览器中打开此地址: http://127.0.0.1:1337/
4) Open this address in your browser: http://127.0.0.1:1337/
这篇关于如何在Xampp本地主机上安装Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!