1

I am getting this error when I try to run Gulp from the task runner I think its related to me updating my npm project but I am not sure how to fix it. Do I need to install a different version of npm?

>Failed to run "C:\WebProjects\ITF\Tool.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
fs.js:47
} = primordials;
^

ReferenceError: primordials is not defined at fs.js:47:5

C:\WebProjects\ITF\Tool.Web>npm ls natives
tools@1.0.0 C:\WebProjects\ITF\Tool.Web
`-- gulp@3.9.1
  `-- vinyl-fs@0.3.14
    `-- graceful-fs@3.0.12
      `-- natives@1.1.6

Version

C:\WebProjects\ITF\Tool.Web>npm -v
8.5.5
Jefferson
  • 71
  • 3
  • 12
  • Does this answer your question? [How to fix "ReferenceError: primordials is not defined" in Node.js](https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node-js) – Mark Apr 07 '22 at 20:50

1 Answers1

2

Judging from your version of npm, you seem to be using Node.js 17.8.0, which is currently the latest version. Now, Gulp 3 does not work in any currently maintained version of Node.js (see issue).

You should upgrade to Gulp 4 to fix the error.

GOTO 0
  • 42,323
  • 22
  • 125
  • 158
  • Odd numbered major versions of Node.js become unsupported after 6 months. It may be better to instead use the even numbered 16.x in production, as it will enter long-term support mode later this year whereas 17.x will hit end of life in June. [https://nodejs.org/en/about/releases/](About Node.js releases) – Mark Hanna Apr 07 '22 at 21:11
  • 1
    @MarkHanna I think I wasn't clear enough. I wasn't suggesting to use Node.js 17.8.0, rather imagining that this was the version used by the OP basing on the information that the npm version is 8.5.5. I reworded my answer to make it clearer. – GOTO 0 Apr 07 '22 at 22:03
  • Would it be better to downgrade Node.js so Gulp 3 would work? I wouldn’t want to rewrite the gulp script? – Jefferson Apr 07 '22 at 23:25
  • @Jefferson It depends, I'd say, on why you updated your project in the first place. Just note that Gulp 3, like Node.js < 12, is no longer maintained. – GOTO 0 Apr 08 '22 at 05:27