2

I am facing error with fresh installed Angular when I run grunt serve command I get

I am using Node 12.6.1 with Source Tree and verified that bower is installed

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

georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • 2
    check this https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node, this is for gulp, but looks similar – 3960278 Feb 21 '20 at 14:20
  • 1
    When you run `npm update` or `npm install` do you see anything related to a deprecated package? – Julien Feb 21 '20 at 14:46

1 Answers1

11

The cdnify plugin is outdated and not maintained anymore. You can use one of the replacements. I use grunt-google-cdn2

Step 1: add the package

npm install --save grunt-google-cdn2

Step 2: change the grunt-cdnify plugin loader to use the new package in your Gruntfile.js

Your Gruntfile.js might differ, but you need to change the plugin you use from grunt-cdnify to 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',        
});

Step 3: Remove the old grunt-cdnify plugin from your package.json

Roberto
  • 403
  • 2
  • 9