SPFx WebPart – Primordials is not defined – Gulp Commands

Sathish Nadarajan
 
Solution Architect
May 9, 2020
 
Rate this article
 
Views
4248

Recently built a new VM for the SPFx development and as part of that installed the node and gulp. After creating the first WebPart and when trying to build using the gulp was getting the below exception. primordials is not defined

ReferenceError: primordials is not defined
at fs.js:35:5
at req_ (C:\WORK\SourceCode\spfxsolution\node_modules\natives\index.js:143:24)
at Object.req [as require] (C:\WORK\SourceCode\spfxsolution\node_modules\natives\index.js:55:10)
at Object. (C:\WORK\SourceCode\spfxsolution\node_modules\gulp\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (C:\WORK\SourceCode\spfxsolution\node_modules\gulp\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)

Then realized that the node version and gulp version will have a mismatch. Verified my node and gulp versions.

C:\WORK\SourceCode\spfxsolution
λ node –version
v12.16.3

C:\WORK\SourceCode\spfxsolution
λ gulp –version
CLI version: 2.2.0
Local version: 3.9.1

Either, I need to upgrade the gulp version or downgrade the node version.
Tried various commands to do this and at least for me, none of the things were working. At last, uninstalled the node and again reinstalled through the msi itself. We can uninstall from appwiz.cpl as any other application.

You can download the version 10.20.1 from the below link.

https://nodejs.org/download/release/v10.20.1/
After that, the gulp commands started working.

Happy Coding
Sathish Nadarajan

Category : Office 365, SharePoint, SPFx

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Leave a comment