Alecaddd / WordPressPlugin101

Official repository of the series of tutorial on How to Create a WordPress Plugin from scratch: https://www.youtube.com/playlist?list=PLriKzYyLb28kR_CPMz8uierDWC2y3znI2
MIT License
408 stars 369 forks source link

Changes in Gulp notation from version 3 to 4 #19

Open Michagin opened 3 years ago

Michagin commented 3 years ago

Gulp is introduced in episode 19. However, gulp recently went from version 3 to 4 and with that, a new notation is used. function arguments are now supposed to be used with gulp.task( 'default', gulp.series('styles', 'js'), function() { instead of an ordinary array gulp.task( 'default', ['styles', 'js'], function() {. Converting tasks are easy, however, when I run Gulp Watch, I get this error:

[13:41:35] Starting 'watch'...
[13:41:35] Starting 'default'...
[13:41:35] Starting 'styles'...
[13:41:35] The following tasks did not complete: watch, default, styles
[13:41:35] Did you forget to signal async completion?

I tried setting the required gulp version to 3.9.1 but that gave me 9 high severity vulnerabilities when running npm install. When fixing them using npm audit fix (and then the recommended npm audit fix --force), npm sets Gulp's decency back to 4.0.2 as of today (Marts. 4th, 2021).

RensDuijsens commented 3 years ago

Same issue here. I have tied 5 or 6 ways to solve this. Downgrading, altering the sources. Running a recovery tool. Reinstalling the software. Reinstalling the correct version in a VM-Ware machine. Etcetera.

I can NOT get it to work. Help please?

ori1989 commented 3 years ago

Fix it in one minute: Just follow these steps. I'm on Windows 10 and it worked perfectly for me!

In the same directory where you have package.json create a npm-shrinkwrap.json file with the following contents:

{
  "dependencies": {
    "graceful-fs": {
        "version": "4.2.2"
     }
  }
}

Run npm install, and don't worry, it will update npm-shrinkwrap.json with a bunch of content.

Run gulp to start the project.

Taken from: https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node-js