如何在net beans中运行node.js文件?

Aar*_*thi 8 netbeans node.js

在net beans我安装了node.js pulgin.But我的示例节点程序不工作.我收到错误.这是我的示例代码

    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/");/* 
Run Code Online (Sandbox Code Playgroud)

在运行上述程序时.我遇到以下错误.

                  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
Run Code Online (Sandbox Code Playgroud)

但是上面的程序可以在终端上运行.

Nah*_*ahn 16

据我所知,目前Node.js有2个netbeans插件

你使用的那个 http://plugins.netbeans.org/plugin/36653/nodejs

(非常简单的插件,它没有做太多(我在较旧版本的netbeans上使用它),我无法让它在netbeans上工作7.4)

第二个:

NetBeans NodeJS插件 https://github.com/timboudreau/nb-nodejs

我想建议您切换到第二个,因为:

  • 它确实有效
  • 它提供了"节点项目类型"
  • 更多