如何在 Xampp localhost 上安装 nodejs [英] How to install nodejs on Xampp localhost
问题描述
看到很多关于如何安装 nodejs 的方法,但没有什么是完全清楚的.
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?
推荐答案
搜索后(source),我发现直接安装 Node.js 更容易(因此,不需要 XAMP/WAMP):
After searching (source), I have found, that it's easier to install Node.js directly (so, no need of XAMP/WAMP):
创建一个测试文件(示例)C:myFolder est.js 并将此代码放入该文件中:
Create a test file (example) C:myFolder est.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
');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
打开 CMD(命令提示符)并执行:
Open CMD (COMMAND PROMPT) and execute:
节点 C:myFolder est.js
在浏览器中打开此地址:http://127.0.0.1:1337/
Open this address in your browser: http://127.0.0.1:1337/
这篇关于如何在 Xampp localhost 上安装 nodejs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!