How to fix ReferenceError: primordials is not defined in node

Ramesh picture Ramesh · Apr 30, 2019 · Viewed 437.3k times · Source

I have installed node modules by npm install, then I tried to do gulp sass-watch in command prompt. After that I got the below response.

[18:18:32] Requiring external module babel-register
fs.js:27
const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined

Have tried this before gulp sass-watch

npm -g install gulp-cli

Answer

Hassan Hodges picture Hassan Hodges · Apr 30, 2019

I hit the same error. I suspect you're using node 12 and gulp 3. That combination does not work: https://github.com/gulpjs/gulp/issues/2324

A previous workaround from Jan. does not work either: https://github.com/gulpjs/gulp/issues/2246

Solution: Either upgrade to gulp 4 or downgrade to an earlier node.