When use gulp in an old project, It outputs an error:
1 2 3 4 5 6
fs.js:45 } = primordials; ^
ReferenceError: primordials is not defined // ...
And how to fix this error?
It occurs when use gulp 3.x with node upper than 12.x,because gulp 3.x depends on graceful-fs@^3.0.0 which patches Node’s fs module and that patch worked well before node v12.
Solutions
There are some solutions:
upgarde gulp
downgrade node
to lock graceful-fs to version 4.2.2
For me, i do not want to re-write and re-config my project toolchain, and i also cannot change node version. So lock the gracefull-fs is good for me. The concrete solution here: