在使用grunt的虚拟机上使用liverload时出错
Error using LiveReload on virtual machine with grunt
我正在使用一个装有vagrant/puphpet (ubuntu 12.04)的virtualbox。我成功地设置了grunt和contrib-watch。我安装了chrome扩展…此处指定的所有内容:https://github.com/gruntjs/grunt-contrib-watch#live-reloading
我的Gruntfile如下:
module.exports = function(grunt)
{
require('load-grunt-tasks')(grunt);
grunt.initConfig({
compass: { // Task
dist: { // Target
options: { // Target options
sassDir: 'sass',
cssDir: 'css',
environment: 'development',
httpPath: '/',
imagesDir: 'img',
relativeAssets: true
}
}
},
watch: {
options: { livereload: true },
sass: {
files: ['sass/**/*.scss'],
tasks: ['compass'],
options: { spawn: false }
}
}
});
grunt.registerTask('default', ['compass']);
}
我运行命令"grunt watch",它处理我的sass正确。但在Chrome的控制台,我得到以下错误:
GET http://127.0.0.1:35729/livereload.js?ext=Chrome&extver=2.0.9
net::ERR_CONNECTION_REFUSED injected.js:116
如果我在我的视图中手动添加脚本,我仍然得到错误:
GET http://localhost:35729/livereload.js net::ERR_CONNECTION_REFUSED
你的gruntfile看起来不错。
看起来您的虚拟机拒绝连接。请确保在iptables中打开了实时重新加载端口。
在Ubuntu中,可以简单地使用ufw:
sudo apt-get install ufw
sudo ufw enable
sudo ufw allow 35729/tcp
相关文章:
- javascript中的数组出错
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- 在Meteor项目中安装并包含npm模块后出错
- 解析JSON并从中删除对象会出错
- AngularJS指令出错-无法读取属性'编译'的未定义
- 使用javascript在MVC中查找网格长度时出错
- 尝试调用AngularJS上的函数时出错
- Google 脚本:用于创建日历活动的脚本运行时不会出错,但不会执行任何操作
- 全局安装gull后出错
- 我在代码点火器中出错
- Java脚本将URL转换为已保存的URL时出错
- Backbone.js将模型绑定到视图时出错
- 将javascript代码转换为jquery代码时出错
- 加载db.json时出错
- 在运行时创建元素时移到一边时出错
- 失败:等待Protractor与页面同步时出错:“”;在窗口上找不到角度”;
- 重置表单字段时出错
- 将对象的列表c#传递给javascript:undefined变量时出错
- 地理定位api和谷歌地图出错
- 在使用grunt的虚拟机上使用liverload时出错