0

I'm setting up a development environment for SP2019.

I've installed;

  • Node.js 14.15.0
  • gulp CLI 2.3.0 and Local 3.9.1
  • yeoman 4.3.0
  • @microsoft/generator-sharepoint 1.12.1

Once I've started my new project by running,

yo @microsoft/sharepoint

And come to trusting the dev certificate by running

gulp trust-dev-cert

I'm getting an error

ReferenceError: primordials is not defined
    at fs.js:45:5
    at req_ (U:\SPFx\node_modules\natives\index.js:143:24)
    at Object.req [as require] (U:\SPFx\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (U:\SPFx\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)
    at Object.<anonymous> (U:\SPFx\node_modules\vinyl-fs\node_modules\graceful-fs\graceful-fs.js:3:27)
    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)
About to exit with code: 1
Process terminated before summary could be written, possible error in async code not continuing!
0

The issue stems from the version of node JS and gulp installed.

The easiest solutions would be to downgrade your node to an earlier version of node JS (not recommended) or you upgrade your gulp and dependent packages to a version where that issue is resolved.

See the thread below for in-depth discussion regarding this issue.

https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node-js

0

As it happens, in my case it was nothing to do with the Node version, it was the Gulp version.

Documentation for setting up the SPFx enviornment suggested I needed Gulp 3.9.1 in fact I needed 4+. I ran the below and the certificate was promted for as expected.

npm install gulp@^4.0.2

This was mentioned in the setup but it was easily overlooked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.