I am new to SharePoint custom web part development. I am following https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part to create a custom web part. I keep facing different types of issues when creating a project.
First, I follow https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment to setup my environment. After completing the setup and execute yo @microsoft/Sharepoint. I got below error: 
So, I downgraded my sharepoint-generator version from 1.14x to 1.11.x/1.12.x. I am able to create a project, but when I use "gulp serve", an error occurs again: gulp --task ReferenceError: primordials is not defined at fs.js:45:5 at req_ (C:\Users\username\CustomWebPart\spfx-40-fantastics-master\node_modules\natives\index.js:143:24) at Object.req [as require] (C:\Users\username\CustomWebPart\spfx-40-fantastics-master\node_modules\natives\index.js:55:10) at Object. (C:\Users\username\CustomWebPart\spfx-40-fantastics-master\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18)
Current Setting: npm list -g --depth=0 +-- @angular/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- [email protected] +-- [email protected] +-- [email protected] +-- [email protected] +-- [email protected] `-- [email protected]
node --version v14.15.0
npm -v 6.14.8
Can anyone help me? I am really frustrated and I don't know which parts when wrong.
----Update @20220421----
I followed Rob action to uninstall and install the gulp-cli. still no luck. C:\Windows\system32>npm list -g --depth=0 C:\Users(username)\AppData\Roaming\npm +-- @angular/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- [email protected] +-- [email protected] +-- [email protected] +-- [email protected] +-- [email protected] `-- [email protected]
C:\Windows\system32>node --version v14.15.0
C:\Windows\system32>npm -v 6.14.8
C:\Windows\system32>npm uninstall gulp-cli --global removed 254 packages in 2.677s
C:\Windows\system32>npm uninstall gulp --global up to date in 0.033s
C:\Windows\system32>npm uninstall @microsoft/generator-sharepoint --global removed 1433 packages in 10.868s
C:\Windows\system32>npm install gulp-cli --global C:\Users(username)\AppData\Roaming\npm\gulp -> C:\Users(username)\AppData\Roaming\npm\node_modules\gulp-cli\bin\gulp.js
[email protected] postinstall C:\Users(username)\AppData\Roaming\npm\node_modules\gulp-cli\node_modules\es5-ext node -e "try{require('./_postinstall')}catch(e){}" || exit 0
- [email protected] added 254 packages from 165 contributors in 10.574s
C:\Windows\system32>npm install --global @microsoft/[email protected]
[email protected] install C:\Users(username)\AppData\Roaming\npm\node_modules@microsoft\generator-sharepoint\node_modules\node-sass node scripts/install.js
Cached binary found at C:\Users(username)\AppData\Roaming\npm-cache\node-sass\4.14.1\win32-x64-83_binding.node
[email protected] postinstall C:\Users(username)\AppData\Roaming\npm\node_modules@microsoft\generator-sharepoint\node_modules\node-sass node scripts/build.js
Binary found at C:\Users(username)\AppData\Roaming\npm\node_modules@microsoft\generator-sharepoint\node_modules\node-sass\vendor\win32-x64-83\binding.node Testing binary Binary is fine
- @microsoft/[email protected] added 1430 packages from 689 contributors in 64.521s
C:\Windows\system32>cd C:\Users(username)\CustomWebPart\NewVersionTest
C:\Users(username)\CustomWebPart\NewVersionTest>yo @microsoft/sharepoint
Let's create a new SharePoint solution. ? What is your solution name? NewVerTest ? Only SharePoint Online (latest) is supported. For earlier versions of SharePoint (2016 and 2019 ) please use the 1.4.1 version of the generator. SharePoint Online only (latest) ? Do you want to allow the tenant admin the choice of being able to deploy the solution to all sit es immediately without running any feature deployment or adding apps in sites? No ? Will the components in the solution require permissions to access web APIs that are unique and n ot shared with other components in the tenant? No ? Which type of client-side component to create? WebPart Add new Web part to solution new-ver-test. ? What is your Web part name? NewVerTest ? What is your Web part description? no ? Which framework would you like to use? No JavaScript framework
Error @microsoft/sharepoint
Trying to copy from a source that does not exist: C:\Users(username)\AppData\Roaming\npm\node_modules@microsoft\generator-sharepoint\lib\generators\solution\templates\spo\tsconfig.json
C:\Users(username)\CustomWebPart\NewVersionTest>npm list --depth=0 -g C:\Users(username)\AppData\Roaming\npm +-- @angular/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- [email protected] +-- [email protected] +-- [email protected] +-- [email protected] +-- [email protected] `-- [email protected]
C:\Users(username)\CustomWebPart\NewVersionTest>npm list gulp C:\Users(username)\CustomWebPart `-- [email protected]

