The problem description is basically identical to the one answered here but the solution given for that one won't work for me.
I've been running Gulp and XAMPP for over a year on this machine to develop a number of Wordpress sites locally before launch. This problem appeared without apparent warning yesterday and is affecting all my local projects. I didn't update anything that I'm aware of preceding this, although I'm running Windows 10 so it's possible an OS update I wasn't aware of broke things.
The full text of the error in PowerShell:
gulp : The term 'gulp' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + gulp go + ~~~~ + CategoryInfo : ObjectNotFound: (gulp:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException`
Interestingly, cmd.exe gives a different error, which I can't understand at all:
AssertionError [ERR_ASSERTION]: Task function must be specified at Gulp.set [as _setTask] (C:\xampp\htdocs\domainname.com\node_modules\undertaker\lib\set-task.js:10:3) at Gulp.task (C:\xampp\htdocs\domainname.com\node_modules\undertaker\lib\task.js:13:8) at Object. (C:\xampp\htdocs\domainname.com\gulpfile.js:37:6) at Module._compile (internal/modules/cjs/loader.js:1158:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) at Module.load (internal/modules/cjs/loader.js:1002:32) at Function.Module._load (internal/modules/cjs/loader.js:901:14) at Module.require (internal/modules/cjs/loader.js:1044:19) at require (internal/modules/cjs/helpers.js:77:18) at execute (C:\Users\username\AppData\Roaming\npm\node_modules\gulp\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js:36:18) { generatedMessage: false, code: 'ERR_ASSERTION', actual: false, expected: true, operator: '==' }`
EDIT: I got the above error when Gulp was installed globally. After uninstalling it globally (still installed locally to this project) I get the more expected error:
'gulp' is not recognized as an internal or external command, operable program or batch file.`
/END EDIT
NPM commands are not affected, and I've tried various combinations of uninstalling, reinstalling, and updating gulp, including globally, all to no avail. I have tried updating node.js, also to no effect.
Although I've been using Gulp/NPM/Node for some time, I am not a superuser and my command line skills are rudimentary, so there may be something I've missed in my troubleshooting. All thoughts and possibilities will be gratefully accepted, as I'm in a somewhat desperate position and unable to do almost any development work because of this problem.