Hi here you go this should work, after you run bellow command:
npm install @microsoft/generator-sharepoint --save-dev
you should run the following command:
Make sure you allow access when popups come
Often, it’s due to location ref issues (path to the modules when installed globally), so when you run gulp it does not know where to look (can be caused by system update, nvm bugs (if you use it), etc.
You can try this approach: https://stackoverflow.com/questions/24027551/gulp-command-not-found-error-after-installing-gulp/41419949
Witch propose many ...