grunt watch livereload致命错误:端口35279已被另一进程使用 [英] grunt watch livereload Fatal error: Port 35279 is already in use by another process

查看:395
本文介绍了grunt watch livereload致命错误:端口35279已被另一进程使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用livereload与手表。我不断收到消息致命错误:端口35279已被另一进程使用。我已经改变了livereload的端口,但没有重新加载。

  module.exports = function(grunt){
grunt.initConfig({
pkg:grunt。 file.readJSON('package.json'),
指南针:{
dist:{
options:{
cssDir:'stylesheets',
sassDir:'stylesheets / sass /',
imagesDir:'images',
javascriptsDir:'scripts',
require:['sass-globbing','modular-scale'],
force :true
}
}
},
cssmin:{
minify:{
展开:true,
cwd:'stylesheets',
src:['* .css','!* .min.css'],
dest:'stylesheets',
ext:'.min.css'
}
},
watch:{
options:{
livereload:true
},
sass:{
files:'stylesheets / sass /*.scss',
任务:['compass']
},
css:{
files:'stylesheets / *。css',
tasks:['cssmin']
},
html:{
files:['index .html','** / * .css']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default',['compass','watch']);

}

解决方案 div>

添加

 < script src =// localhost:1337 / livereload.js>< /脚本> 

到您想要重新加载的页面。 1337是您设置在grunt文件中的端口。

 选项:{
livereload:1337
},


I'm trying to use livereload with watch. I keep getting the message "Fatal error: Port 35279 is already in use by another process" . I've changed the port for livereload but then nothing reloads.

module.exports = function(grunt) {
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    compass: {
      dist: {
        options: {
          cssDir: 'stylesheets',
          sassDir: 'stylesheets/sass/',
          imagesDir: 'images',
          javascriptsDir: 'scripts',
          require: ['sass-globbing','modular-scale'],
          force: true
        }
      }
    },
    cssmin: {
      minify: {
        expand: true,
        cwd: 'stylesheets',
        src: ['*.css', '!*.min.css'],
        dest: 'stylesheets',
        ext: '.min.css'
      }
    },
    watch: {
        options: {
            livereload: true
        },
        sass: {
            files: 'stylesheets/sass/*.scss',
            tasks: ['compass']
        },
        css: {
            files: 'stylesheets/*.css',
            tasks: ['cssmin']
        },
        html: {
            files: ['index.html','**/*.css']
        }
    }
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default',['compass','watch']);

}

解决方案

Add

 <script src="//localhost:1337/livereload.js"></script>

to the page you want livereload on. 1337 being the port you set it to in the grunt file.

options: {
        livereload: 1337
},

这篇关于grunt watch livereload致命错误:端口35279已被另一进程使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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