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...
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
42 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.
We encountered the same issue when updating a legacy project depending on gulp@3.9.1 to Node.js 12+.
These fixes enable you to use Node.js 12+ with gulp@3.9.1 by overriding graceful-fs to version ^4.2.9.
Must Read
If you are using yarn v1
Yarn v1 supports resolving a package to a defined version.
You need to add a resolutions section to your package.json:
{
// Your current package.json contents
"resolutions": {
"graceful-fs": "^4.2.9"
}
}
Thanks @jazd for this way to solve the issue.