我做了所有的事情,比如helloworld的nodejs.org教程,但我有一个大问题。如下图所示:
图片来源:http://i.imgur.com/EjAMXcS.png
我将example.js文件保存到D:目录...
如何启动node.js代码:
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8080);
console.log('Server started');发布于 2014-11-19 00:30:00
您可以从命令行(例如Windows Power Shell)运行node example.js,而不是从Node.js REPL内部运行。
发布于 2014-11-19 03:18:57
在命令提示符下,导航到D盘,然后键入node example.js以运行代码。
当您使用像morgan这样的包时,您需要在使用them.Standard之前安装它们。安装包的方法是(同样从命令提示符)导航到您的应用程序文件夹并输入npm install <package-name>。欲了解更多信息,请查看此处:https://www.npmjs.org/doc/cli/npm-install.html
https://stackoverflow.com/questions/26999169
复制相似问题