node.jsnpmgulpnpm-run

npm run gulp primordials not defined


I'm trying to run npm run gulp and I'm coming up with this primordials is not defined error (I have also added the npm-shrinkwrap.json file as suggested which gets updated after running npm install but it doesn't fix my primordials is not define error):

> gulp-tutorial@1.0.0 gulp
> gulp

fs.js:47
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:47:5
    at req_ (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147: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)

Node.js v17.0.1

Any suggestions 🙌 ?


Solution

  • The problem was with the versions not matching up. I also had 2 NodeJS installation paths and that was throwing things off.

    I uninstalled them all, started from the beginning and used brew to reinstall.

    Then checked that the versions were all compatible.

    I also had to install node-sass and referred to this compatibility table to get the correct version - https://github.com/sass/node-sass#node-version-support-policy

    Now its working and I can get on developing :) As of today Im running Node v17.0.1 Npm v8.1.0 Gulp cli v2.3.0