Anu Mathew
Anu Mathew

Reputation: 41

Unable to Run any Gulp commands

I am relatively new to NodeJS and am learning to develop using Sharepoint Framework. It was working fine and all of a sudden started to throw errors.

My NodeJS version is: V10.13.0.

My gulp version is: CLI - 2.0.1 Local - 3.9.1

I get the following error when I try to use gulp serve or gulp bundle:

Error: Your dev environment is running NodeJS version v10.13.0 which does not meet the requirements for running this tool. This tool requires a version of NodeJS that matches >=8.9.4 <9.0.0.......

Could someone help me fix this issue please?

Many Thanks,

Upvotes: 0

Views: 9771

Answers (5)

BigDataFiles
BigDataFiles

Reputation: 185

On Windows, I got a similar error.

Error: Your dev environment is running NodeJS version v18.9.1 which does not meet the requirements for running this tool. This tool requires a version of NodeJS that matches >=12.13.0 <13.0.0 || >=14.15.0 <15.0.0 || >=16.13.0 <17.0.0 || >=18.17.1 <19.0.0
    at SPWebBuildRig.initialize (C:\Users\evaughan\OneDrive - PhishingBox LLC\Documents\PBox General\Scripts\Sharepoint\node_modules\@microsoft\sp-build-web\lib\SPBuildRig.js:50:19)
    at Object.initialize (C:\Users\evaughan\OneDrive - PhishingBox LLC\Documents\PBox General\Scripts\Sharepoint\node_modules\@microsoft\sp-build-web\lib\index.js:35:17)
    at Object.<anonymous> (C:\Users\evaughan\OneDrive - PhishingBox LLC\Documents\PBox General\Scripts\Sharepoint\gulpfile.js:16:7)
    at Module._compile (node:internal/modules/cjs/loader:1119:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Module._load (node:internal/modules/cjs/loader:838:12)
    at Module.require (node:internal/modules/cjs/loader:1021:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at requireOrImport (C:\Users\evaughan\AppData\Roaming\npm\node_modules\gulp-cli\lib\shared\require-or-import.js:19:11)

To fix it, I uninstalled NodeJS, downloaded and ran the MSI for 18.17.1 from here: https://nodejs.org/dist/v18.17.1/

Upvotes: 0

Raj Kumar
Raj Kumar

Reputation: 31

The current supported LTS version of NodeJS for the SharePoint Framework is Node.js v8.x and Node.js v10.x. Notice that 9.x, 11.x or 12.x versions are currently not supported with SharePoint Framework development.

Upvotes: 0

Utkarsh Dubey
Utkarsh Dubey

Reputation: 776

Another solution for this is to install the Node version manager and then you can manage the version of node.js using it.

nvm-windows

Install the .exe file and then manage the node.js version.

node version manager command:

Usage:

  nvm install <version>        : Install node.js specific version
  nvm list                     : List the node.js installations.       
  nvm use [version]            : Switch to specific node.js version
  .....
  ...

Upvotes: 3

Jim Parker
Jim Parker

Reputation: 365

Here's another possible solution:

I had this same issue, except the resolution for me was to "READ" :) For others facing this same issue, please note the following from the Microsoft site:

Notice that 9.x or 10.x versions are currently not supported with SharePoint Framework development.

This meant I had to downgrade my Nodejs version back to 8.13, since anything above 9.0 won't work with SPFX (currently).

excerpt from this page: https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment

Upvotes: 0

Anu Mathew
Anu Mathew

Reputation: 41

I managed to fix this issue.

To those who would possibly benefit from this:

The error occurred after I upgraded @microsoft/generator-sharepoint to the latest version. Once uninstalling version 1.7.0 and installing 1.6.0, everything started to work smoothly as expected.

Thanks

Upvotes: 3

Related Questions