2017-03-21 43 views
0

我试图开始使用grunt与bower一起构建我的项目。所以现在我只想使用grunt plugin wiredep将所有安装的bower包注入到我的index.html文件中。Grunt - Wiredep警告:“必须提供图案”

当我尝试运行繁重的命令,它总是说:

运行“wiredep:目标”(wiredep)任务 警告:必须提供模式中使用--force继续。

由于警告而中止。完成。

我发现其他主题有同样的错误,但没有一个解决方案似乎对我有用。

这是我grunfile

module.exports = function (grunt) { 

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

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

    grunt.loadNpmTasks('grunt-wiredep'); 

}; 

这是我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": {} 
} 

这是我的index.html:

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

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

有人能告诉我什么是错的?

+0

对我来说看起来不错,你确定那是http://stephenplusplus.github.io/grunt-wiredep/? – ayxos

+0

是的,我已经通过'npm install grunt-wiredep --save-dev'来安装它,就像在教程中一样。如果这个问题很重要,我使用netbeans 8.2作为我的IDE。 – flixe

回答

0

问题出在arcgis-js-api。它的bower.json不提供main字段,导致与grunt-wiredep有关的问题。

https://github.com/taptapship/wiredep

您将需要从你的咕噜,wiredep目标排除或覆盖,并提供一个合适的主,如果它是被链接。

相关问题