0

I have 2 versions of node.js, as follow:-

Your environment has been set up for using Node.js 17.1.0 (x64) and npm.
C:\Windows\System32>nvm list

    16.13.0
    8.16.2

Now i am trying to run gulp serve on this SPFx web part @ https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-enhanced-list-formatting .. but i got this error:-

C:\spfx-MyModalPopup>gulp serve
ReferenceError: primordials is not defined
    at fs.js:47:5
    at req_ (C:\spfx-MyModalPopup\node_modules\natives\index.js:143:24)
    at Object.req [as require] (C:\spfx-MyModalPopup\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (C:\spfx-MyModalPopup\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)

C:\spfx-MyModalPopup>nvm use 16.13.0
exit status 145: The directory is not empty.

so what is going on ? thanks

1

Before running gulp serve command, first make sure you successfully select a node version. When you run nvm list, make sure you have (Currently using 64-bit executable) next to the correct node version. If you don't see it, then your nvm use didn't work.

    14.15.0
    12.13.0
    10.24.0
    10.23.0
  * 8.16.2  (Currently using 64-bit executable)
    6.10.3

Overall, it seems you didn't install nvm for windows correctly. Please, make sure you read the nvm for Windows' manual and follow it exactly. Don't cut corners and don't jump to the next steps until you do it.

Notable quotes

Uninstall any existing versions of Node.js before installing NVM for Windows (otherwise you'll have conflicting versions). Delete any existing Node.js installation directories (e.g., %ProgramFiles%\nodejs) that might remain. NVM's generated symlink will not overwrite an existing (even empty) installation directory.

nvm-windows runs in an Admin shell. You'll need to start powershell or Command Prompt as Administrator to use nvm-windows

Overall, this is not a SharePoint-related question. You will get better chances of getting help on the Stack Overflow. I see you cross-posted the same question there.

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.