When use gulp
in an old project, It outputs an error:
1 | fs.js:45 |
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 version4.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:
- create publishable lockfile
npm-shrinkwrap.json
- edit the
npm-shrinkwrap.json
:
1 | { |
- re-run
npm install
Now, it should be working just fine. Enjoy it!