如何在Net Bean中运行node.js文件? [英] How to run the node.js file in net beans?

查看:94
本文介绍了如何在Net Bean中运行node.js文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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...!\n");

      }).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 Files\NetBeans 7.0.1\hello.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屋!

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