简体   繁体   中英

Grunt - Wiredep Warning: “Must provide pattern”

I#m trying to get started using grunt together with bower to build my project. So right now i simply want to inject all my installed bower packages into my index.html file using the grunt plugin wiredep.

When i try to run the grunt command it always says:

Running "wiredep:target" (wiredep) task Warning: must provide pattern Use --force to continue.

Aborted due to warnings. Done.

I have found other topics with the same error, but none of the solutions seemed to work for me.

This is my grunfile :

module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        wiredep: {

            target: {
                src: '/public_html/index.html'
            }
        }
    });

    grunt.loadNpmTasks('grunt-wiredep');

};

This is my bower.json :

{
  "name": "GeoSystem",
  "version": "1.0.0",
  "main": "/public_html/js/model.js",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {"jQuery":"3.2.0",
    "arcgis-js-api": "4.3.0",
    "OpenLayers": "4.0.1",
    "bootstrap": "3.3.7"
  },
  "devDependencies": {}
}

This is my index.html:

<!DOCTYPE html>
<head>
    <!-- bower:css -->
    <!-- endbower -->
</head>
<body>
    <div class="container">
        <div id="map"></div>
    </div>

    <!-- bower:js -->
    <!-- endbower -->
</body>

Can someone tell me what's wrong?

The issue is with arcgis-js-api . Its bower.json does not provide a main field which causes an issue with grunt-wiredep .

https://github.com/taptapship/wiredep

You will need to exclude it from your grunt-wiredep target or override and provide an appropriate main if it is to be linked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM