"警告:"路径"参数必须是string类型使用--force继续。"

时间:2018-04-27 16:47:38

标签: npm gruntjs

当我尝试在新的dev安装上运行grunt时收到此错误:

  

"Warning: The "path" argument must be of type string Use --force to continue."

这是gruntfile.js的样子。我排除了错误的路径,还有什么可能导致这种情况,以及如何识别错误路径所在的位置?

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

// Load all grunt tasks
require( 'matchdep' ).filterDev( 'grunt-*' ).forEach( grunt.loadNpmTasks );

// Project configuration
grunt.initConfig( {
    pkg   : grunt.file.readJSON( 'package.json' ),
    concat: {
        options     : {
            stripBanners: true,
            banner      : '/*! <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                ' * <%= pkg.homepage %>\n' +
                ' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
                ' * Licensed GPLv2+' +
                ' */\n'
        },
        jdrf_promise: {
            src : [
                'assets/js/src/jdrf_promise.js',
                'assets/js/src/promise_map.js'
            ],
            dest: 'assets/js/jdrf_promise.js'
        }
    },
    jshint: {
        browser: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require( 'jshint-stylish' )
            },
            src    : [
                'assets/js/src/*.js'
            ]

        }
    },
    uglify: {
        all: {
            files  : {
                'assets/js/jdrf_promise.min.js': ['assets/js/jdrf_promise.js'],
                'assets/js/promise_map.min.js' : ['assets/js/promise_map.js']
            },
            options: {
                banner    : '/*! <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                    ' * <%= pkg.homepage %>\n' +
                    ' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
                    ' * Licensed GPLv2+' +
                    ' */\n',
                mangle    : false,
                beautify  : false,
                semicolons: true
            }
        }
    },
    test  : {
        files: ['assets/js/test/**/*.js']
    },
    compass: {
        dev: {
            options: {
                sassDir    : ['assets/css/sass'],
                cssDir     : ['assets/css'],
                environment: 'development',
                outputStyle: 'expanded'
            }
        },
        dist: {
            options: {
                sassDir: 'assets/css/sass',
                cssDir : 'assets/css/'
            }
        }
    },
    cssmin : {
        options: {
            banner: '/*! <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                ' * <%= pkg.homepage %>\n' +
                ' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
                ' * Licensed GPLv2+' +
                ' */\n'
        },
        minify : {
            expand: true,

            cwd: 'assets/css',
            src: ['jdrf_promise.css'],

            dest: 'assets/css',
            ext : '.min.css'
        }
    },
    watch  : {
        compass: {
            files: ['assets/css/sass/*.scss', 'assets/css/sass/*/*.scss'],
            tasks: ['compass:dev']
        },
        styles: {
            files: ['assets/css/jdrf_promise.css'],
            tasks: ['cssmin']
        },
        scripts: {
            files  : ['assets/js/src/**/*.js', 'assets/js/vendor/**/*.js'],
            tasks  : ['jshint', 'concat', 'uglify'],
            options: {
                debounceDelay: 500
            }
        }
    }
} );

//Dependent plugins
grunt.loadNpmTasks( 'grunt-contrib-compass' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );

// Default task.,
grunt.registerTask( 'default', ['jshint', 'concat', 'uglify', 'compass:dev', 'cssmin' ] );

grunt.util.linefeed = '\n';
};

1 个答案:

答案 0 :(得分:0)

当我为单个值使用数组时,我遇到了同样的问题

enter image description here

因此,如果您只有一个来源,则不应该使用字符串而不是数组

enter image description here