【发布时间】:2012-02-18 21:20:47
【问题描述】:
对 node.js 环境和理念完全陌生,我想回答几个问题。我已经下载了 Windows 安装程序的 node.js 和 node 包管理器。Windows Cmd 提示符当前正在用于运行 nodejs 应用程序。
cls 清除命令窗口或命令提示符中的错误。 node.js 是否有等价物? console.clear 不存在 ;( 还是以其他形式存在?
-
我通过下面这段代码创建了一个服务器
var http = require("http"); http.createServer(function (request, response) { response.writeHead(200, { "Content-Type": "text/html" }); response.write("Hello World"); console.log("welcome world")response.end(); }).listen(9000, "127.0.0.1");
我将代码更改为下面并刷新浏览器发现内容类型没有改变,我如何才能看到变化?
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
console.log("welcome world")
response.end();
}).listen(9000,"127.0.0.1");
【问题讨论】:
-
重启服务器查看变化
-
@Raynos 我该怎么做。关闭命令提示符并再次打开它?伙计,我会开始讨厌 NodeJs。没有办法清除控制台?
-
清除什么控制台? windows cmd shell 或 powershell 或 unix shell?你试过
cls或clear吗? -
对于那些想要清除控制台历史/建议的人:stackoverflow.com/a/35016953/1486850
标签: windows node.js console windows-vista