Error
TypeError: lookups.flatMap is not a function
at Environment.resolver.lookup (C:\Users\z004d41h\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\lib\resolver.js:70:27)
at pre (C:\Users\z004d41h\AppData\Roaming\npm\node_modules\yo\lib\cli.js:89:3)
at prompt.then.result (C:\Users\z004d41h\AppData\Roaming\npm\node_modules\yo\node_modules\insight\lib\index.js:176:4)
at process._tickCallback (internal/process/next_tick.js:68:7)
If you are using still version 11.1 of SPFx you may fall in this error when running
--Microsoft Generator
yo @microsoft/sharepoint
--PnP Generator
yo @pnp/spfx
This is because you don’t have the right versions of Gulp and Yeomen
Uninstall
--Run first
npm list -g --depth=0
--Uninstall
npm uninstall -g gulp
npm uninstall -g yo
Install
npm install -g gulp@3.9.1
npm install -g yo@3.1.0
Try again