【问题标题】:Grunt Serve stopped working with cdnify load errorGrunt Serve 停止使用 cdnify 加载错误
【发布时间】:2020-06-05 21:53:11
【问题描述】:

当我运行 grunt serve 命令时,我遇到了新安装的 Angular 错误

我正在使用 Node 12.6.1 和 Source Tree 并验证是否安装了 bower

Loading "cdnify.js" tasks...ERROR
>> ReferenceError: primordials is not defined

Running "serve" task

Running "clean:server" (clean) task
>> 1 path cleaned.

Running "wiredep:app" (wiredep) task

Running "wiredep:test" (wiredep) task

Running "concurrent:server" (concurrent) task

    Loading "cdnify.js" tasks...ERROR
    >> ReferenceError: primordials is not defined

    Running "copy:styles" (copy) task
    Copied 3 files

    Done.


    Execution Time (2020-02-21 18:22:53 UTC+5:30)
    loading tasks  13ms  ███████████ 22%
    copy:styles    45ms  █████████████████████████████████████ 78%
    Total 58ms

Running "autoprefixer:server" (autoprefixer) task
>> 3 autoprefixed stylesheets created.

Running "connect:livereload" (connect) task
Started connect web server on http://localhost:9000

【问题讨论】:

  • 检查这个stackoverflow.com/questions/55921442/…,这是为了gulp,但看起来很相似
  • 当您运行 npm updatenpm install 时,您是否看到任何与已弃用的软件包相关的信息?

标签: angular gruntjs bower


【解决方案1】:

cdnify 插件已过时,不再维护。您可以使用其中一种替代品。我用grunt-google-cdn2

第 1 步:添加包

npm install --save grunt-google-cdn2

第 2 步: 更改 grunt-cdnify 插件加载器以使用 Gruntfile.js

中的新包

您的 Gruntfile.js 可能会有所不同,但您需要将您使用的插件从 grunt-cdnify 更改为 grunt-google-cdn2

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

第 3 步:package.json

中删除旧的 grunt-cdnify 插件

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-23
    • 1970-01-01
    • 2014-04-03
    • 2014-06-23
    • 2015-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多