如何在 net bean 中运行 node.js 文件? [英] How to run the node.js file in net beans?
问题描述
在 net bean 中,我安装了 node.js pulgin.但是我的示例节点程序不起作用.我收到错误.这是我的示例代码
In net beans i have installed node.js pulgin.But my sample node program is not working.Im getting error. This is my sample code
var http = require("http");
http.createServer(function (req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
res.end("Hai! welcome to node.js...!
");
}).listen(3030, "localhost");
console.log("Server running at http://127.0.0.1:3030/");/*
运行上述程序时,出现以下错误.
While running the above program.Im getting following error.
module.js:340
throw err;
^
Error: Cannot find module 'C:Program FilesNetBeans 7.0.1hello.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:903:3
但是上面的程序是在终端上运行的.
But the above program works from the terminal.
推荐答案
据我所知,目前有 2 个适用于 Node.js 的 netbeans 插件
From my knowledge, currently there are 2 netbeans plugins for Node.js
您正在使用的http://plugins.netbeans.org/plugin/36653/nodejs
(非常简单的插件,它没有太大作用(我在旧版本的 netbeans 上使用它),而且我无法让它在 netbeans 7.4 上工作)
(very simple plugin, it doesn't do much (I used it on an older version of netbeans), and I can't get it to work on netbeans 7.4)
还有第二个:
NetBeans NodeJS 插件https://github.com/timboudreau/nb-nodejs
我想建议你切换到第二个,因为:
I want to suggest that you switch to the second one, because:
- 它确实有效
- 它提供了一个节点项目类型"
- 更多
这篇关于如何在 net bean 中运行 node.js 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!