【问题标题】:Yeoman error launching project with "grunt" commandYeoman 使用“grunt”命令启动项目时出错
【发布时间】:2015-07-01 16:02:39
【问题描述】:

我正在关注 yeoman 教程 http://yeoman.io/codelab/prepare-production.html 并且一切正常,直到我尝试使用“grunt”命令启动我的项目然后我收到以下错误:

Running "autoprefixer:dist" (autoprefixer) taskAutoprefixer's process() method is deprecated and will removed in next major release. Use postcss([autoprefixer]).process() insteadFile .tmp/styles/main.css created.
jit-grunt: Plugin for the "ngtemplates" task not found.If you have installed the plugin already, please setting the static mapping.See https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "ngtemplates" failed. Use --force to continue.
Aborted due to warnings.

我使用 Linux Mint 17

【问题讨论】:

    标签: gruntjs yeoman yeoman-generator-angular


    【解决方案1】:

    A workaround 发布在 generator-angular github 上。尝试修改 Gruntfile.js 使 jit-grunt 块看起来像这样:

    // Automatically load required Grunt tasks
    require('jit-grunt')(grunt, {
      useminPrepare: 'grunt-usemin',
      ngtemplates: 'grunt-angular-templates',
      cdnify: 'grunt-google-cdn'
    });
    

    【讨论】:

    • 感谢对我有用,所以基本上它只是没有生成 angularjs 库绑定,所以我必须手动添加它?我将加载到我的项目中的所有外部库(例如骨干网、sass 等)都需要这项手动工作吗?
    【解决方案2】:

    这是 grunt-autoprefixer 的问题,已弃用。

    我猜,您安装了旧版本的 generator-angular 和当前版本的 grunt,它是在教程中使用以下命令编写的。

    npm install --global yo bower grunt-cli
    npm install --global generator-angular@0.11.1
    

    最好安装当前版本的generator-angular。只需运行它并重新开始。

    npm install -g generator-angular
    

    【讨论】:

    • 感谢您的回答。
    猜你喜欢
    • 2014-04-21
    • 2014-10-04
    • 2012-12-13
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多