Grunt Serve因cdnify加载错误而停止工作



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

我正在使用带有源树的节点12.6.1,并验证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

cdnify插件已经过时,不再维护。您可以使用其中一个替换项。我使用grung-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步:包中删除旧的grunt cdnify插件。json

最新更新