Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "ReferenceError: primordials is not defined" in Node.js

I have installed Node.js modules by 'npm install', and then I tried to do gulp sass-watch in a 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 

I have tried this before gulp sass-watch:

npm -g install gulp-cli 
like image 344
Ramesh Avatar asked Apr 30 '19 12:04

Ramesh


People also ask

How do I know what version of npm I have?

To check the version of globally installed npm packages, run the npm list command with the -g or --global option added.

How do I install Gulp?

To install Gulp locally, navigate to your project directory and run npm install gulp . You can save it to your package. json dependencies by running npm install gulp --save-dev . Once you have Gulp installed locally, you can then proceed to create your gulpfile.


1 Answers

I hit the same error. I suspect you're using Node.js 12 and Gulp.js 3. That combination does not work: Gulp.js 3 is broken on Node.js 12 #2324

A previous workaround from Jan. does not work either: After update to Node.js 11.0.0 running Gulp.js exits with 'ReferenceError: internalBinding is not defined' #2246

Solution: Either upgrade to Gulp.js 4 or downgrade to an earlier version of Node.js.

like image 170
Hassan Hodges Avatar answered Sep 28 '22 10:09

Hassan Hodges