通过虚拟机上的localhost:port访问node.js / grunt服务器

问题描述

得到它了!在我的项目Grunt.js文件中,有以下设置:

grunt.initConfig({
    ...
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost'
      },
    }
    ...
  });

我所要做的就是要改变localhost0.0.0.0和重新启动grunt server

解决方法

我正在通过Grunt在端口9000上本地运行一个node.js服务器。我也有一个正在运行的虚拟机(vmware),但是我无法通过该虚拟机访问节点服务器。我已经配置了VM以通过localhost访问主机上的Apache服务器,但是:9000给出了“未找到”。

有人知道怎么做吗?