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 [email protected] to Node.js 12+.
These fixes enable you to use Node.js 12+ with [email protected] by overriding graceful-fs to version ^4.2.4.
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.4”
}
}
Thanks @jazd for this way to solve the issue.
If you are using npm
Using npm-force-resolutions as a preinstall script, you can obtain a similar result as with yarn v1. You need to modify your package.json this way:
{
// Your current package.json
“scripts”: {
// Your current package.json scripts
“preinstall”: “npx npm-force-resolutions”
},
“resolutions”: {
“graceful-fs”: “^4.2.4”
}
}
npm-force-resolutions will alter the package-lock.json file to set graceful-fsto the wanted version before the install is done.
If you are using a custom .npmrc file in your project and it contains either a proxy or custom registry, you might need to change npx npm-force-resolutions to npx –userconfig .npmrc npm-force-resolutions because as of now, npx doesn’t use the current folder .npmrc file by default.
Origin of the problem
This issue stems from the fact that [email protected] depends on graceful-fs@^3.0.0 which monkeypatches Node.js fs module.
This used to work with Node.js until version 11.15 (which is a version from a development branch and shouldn’t be used in production).
graceful-fs@^4.0.0 does not monkeypatch Node.js fs module anymore, which makes it compatible with Node.js > 11.15 (tested and working with versions 12 and 14).
Note that this is not a perennial solution but it helps when you don’t have the time to update to gulp@^4.0.0.