0

从命令行运行时出现 jshint 错误grunt

    Running "useminPrepare:html" (useminPrepare) task
    Going through public/index.html to update the config
    Looking for build script HTML comment blocks
    Warning: An error occurred while processing a template (Cannot read property 'options' of undefined). Use --force to continue.

    Aborted due to warnings.

在我的 gruntfile 中,我有:

useminPrepare: {
  html: '<%= yeoman.app %>/index.html',
  options: {
    dest: '<%= yeoman.dist %>'
  }
},

yeoman.dist 在 grunt.initConfig 中定义:

yeoman: {
  // configurable paths
  app: require('./bower.json').appPath || 'public',
  dist: 'dist'
},

为什么我收到无法读取未定义的属性“选项”错误?

4

1 回答 1

4

我只是有同样的问题。我在 gruntfile 中配置了错误的另一个任务。我重用了另一个项目中没有定义对象的任务。

从另一个项目我有:

<%= yeoman.dist %>

在这个项目中没有定义。

我通过运行 grunt with--debug --verbose --force来发现它,看看还有什么坏了。中断的任务可能有错误。

于 2014-03-12T17:24:20.100 回答