如何在Xampp本地主机上安装Node.js [英] How to install nodejs on Xampp localhost

查看:231
本文介绍了如何在Xampp本地主机上安装Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

曾经见过很多关于如何安装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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆