javascript - grunt 使用 grunt-contrib-livereload 时提示 Warning: Arguments to path.resolve must be strings Use --force to continue.
大家讲道理
大家讲道理 2017-04-10 14:23:19
[JavaScript讨论组]

命令与返回

P:\ms>grunt live
Running "livereload-start" task
... Starting Livereload server on 35729 ...

Running "connect:livereload" (connect) task
Warning: Arguments to path.resolve must be strings Use --force to continue.

Aborted due to warnings.

Gruntfile.js 部分

livereload: {
        port: 35729 // Default livereload listening port.
},
connect: {
    livereload: {
        options: {
            port: 9001,
            hostname: 'localhost',
            base: '.',
            middleware: function(connect, options) {
                return [lrSnippet, folderMount(connect, options.base)]
            }
        }
    }
},
regarde: {
    jade: {
        files: '*.jade',
        tasks: ['jade']
    },
    html: {
        files: ['index.html', 'css/my.css', 'Gruntfile.js'],
        tasks: ['jsbeautifier', 'livereload']
    },
    coffee: {
        files: 'js/my.coffee',
        tasks: 'coffee'
    }
},

grunt.registerTask('live', ['livereload-start', 'connect', 'regarde']);
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(1)
阿神
  1. Grunt 的版本?请尝试升级一下,这样的问题已经多次提交 issues,升级可解决(包括插件的版本)

  2. 如果升级不见效,请跟随以下步骤:

    1. npm uninstall grunt-cli -g
    2. npm uninstall grunt -g
    3. npm cache clean -g
    4. npm install grunt-cli -g
  3. 之后请确认你的 grunt --versionv0.4.1 以上

  4. 请确认你没有安装多个 grunt,where grunt 查看一下

BTW,别再用 regard + livereload 了,以前 contrib-watch 不好用才用这俩,现在 watch 简直 awesome,配置 livereload 简单无比。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号