I have installed node modules by npm install, then I tried to do gulp sass-watch in 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
Have tried this before gulp sass-watch
npm -g install gulp-cli
I was also getting error on Node 12/13 with Gulp 3, moving to Node 11 worked
I fixed this issue on Windows 10 by uninstalling node from Add or remove programs -> Node.js
Then I installed version 11.15.0 from https://nodejs.org/download/release/v11.15.0/
Choose node-v11.15.0-x64.msi if your running windows 64bit.
This might have come in late but for anyone still interested in keeping their Node v12 while using the latest gulp ^4.0, follow these steps:
Update the command-line interface (just for precaution) using:
Add/Update the
gulp
under dependencies section of your package.jsonDelete your
package-lock.json
fileDelete your
node_modules
folderFinally, Run
npm i
to upgrade and recreate brand new node_modules folder and package-lock.json file with correct parameters for Gulp ^4.0Note Gulp.js 4.0 introduces the
series()
andparallel()
methods to combine tasks instead of the array methods used in Gulp 3, and so you may or may not encounter an error in your oldgulpfile.js
script.To learn more about applying these new features, this site have really done justice to it: https://www.sitepoint.com/how-to-migrate-to-gulp-4/
(If it helps, please leave a thumps up)
Are You Facing ReferenceError: primordials is not defined Error when trying to run gulp? Maybe you’re on gulp v3 and node v12, and that’s the source of the issue.
The thing is, gulp v3 doesn’t work (as of now) under node v12, because it depends on graceful-fs@^3.0.0 which patches Node’s fs module and that patch worked before node v12 just fine.
Solution for ReferenceError: primordials is not defined:
upgrade gulp to v4 . This Solution Will Solve Your Error.
To downgrade Node to v11 To Solve This Error.
To pin graceful-fs to version 4.2.2 that’s known to work under Node v12 – That Option Explained Below This Option Is Worked for me So I recommend you this Option.
Here Is Example Of Option 3
I faced the same issue. What i tried and worked for me:- 1). Check the version of NODE and GULP (combination of node v12 and gulp less than v4 doesn't work) 2). I downgrade npm version by : #sudo npm install -g n #sudo n 10.16.0 It worked fine, then just follow instruction of your consol
had same error and finally fix that when updated all packages and then mentioned the same node engine version and npm version in
package.json
as it is in my local working system.i was getting this error when deploying on heroku.
for more checkout heroku support