2014-05-16 22 views
0

我在Windows开发箱上运行grunt/node/famo.us用于演示应用程序。当我使用Chrome浏览器转到localhost:1377时,一切正常。现在我试图使用ipaddress:1377从同一网络上的另一个盒子访问该站点,但Chrome说它无法找到它。我完全禁用Windows防火墙,但它仍然不会出现。远程调用支持的咕噜网站吗?我在做别的事吗?如何从另一个框中访问grunt站点

这里是我的gruntfile.js:

/*global module:false*/ 

/*Generated initially from grunt-init, heavily inspired by yo webapp*/ 

module.exports = function(grunt) { 
    'use strict'; 

    // Time how long tasks take. Can help when optimizing build times 
    require('time-grunt')(grunt); 

    // Load grunt config 
    require('load-grunt-config')(grunt, { 
    init: true, 
    data: { 
     config: { 
     // Configurable paths 
     app: 'app', 
     dist: 'dist' 
     } 
    } 
    }); 
}; 

回答

1

是,远程调用的支持。进入Gruntfile.js和更改grunt.initConfig连接选项下面..

grunt.initConfig({ 
    // .. Some config 
    // .. 
    connect: { 
     options: { 
      port: grunt.option('port') || 5555, 
      livereload: 35729, 
      // Change this to '0.0.0.0' to access the server from outside 
      hostname: '0.0.0.0' 
     }, 
     // Other Options.. 
     // .. 
    }, 
    // .. More Config 
    // .. 
} 

希望这有助于!

编辑:好的试试这个的话..

/*global module:false*/ 

/*Generated initially from grunt-init, heavily inspired by yo webapp*/ 

module.exports = function(grunt) { 
    'use strict'; 

    // Time how long tasks take. Can help when optimizing build times 
    require('time-grunt')(grunt); 

    // Load grunt config 
    require('load-grunt-config')(grunt, { 
    init: true, 
    data: { 
     config: { 
     // Configurable paths 
     app: 'app', 
     dist: 'dist' 
     }, 
     connect: { 
      options: { 
       port: grunt.option('port') || 5555, 
       livereload: 35729, 
       // Change this to '0.0.0.0' to access the server from outside 
       hostname: '0.0.0.0' 
      }, 
      livereload: { 
       options: { 
        open: true, 
        base: [ 
         '.tmp', 
         '<%= config.app %>' 
        ] 
       } 
      }, 
      dist: { 
       options: { 
        open: true, 
        base: '<%= config.dist %>', 
        livereload: false 
       } 
      } 
     } 
    } 
    }); 
}; 
+0

我已将我的grunt配置文件添加到该问题中,因为我没有看到我要放置的内容。谢谢! – skb

+0

好的..我将我的'连接'配置的全部内容添加到您的gruntfile.js – johntraver

0

在你的呼噜声文件连接选项,尝试完全省略hostname领域。在过去,我遇到了Express和Connect两个问题,其中定义主机名实际上导致服务器只能通过该主机名(例如0.0.0.0,127.0.0.1和localhost)访问,而不能访问NAT IP(例如192.68。 xx或10.0.xx)。我不明白为什么会这样,但值得尝试。

相关问题