5

when I run gulp serve I get the following error.

Your dev environment is running NodeJS version v10.15.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

My current version of

 - Node is 10.15
 - Gulp is 3.9
 - @Microsoft/sp-core-library -1.7.1

I followed this article but it works only for Microsoft framework 1.2.0 but it does not work for Microsoft framework 1.6.0 or Microsoft 1.7.1

When I follow the above article I can run gulp serve but I cannot include the

import { AadHttpClient, HttpClientResponse } from '@microsoft/sp-http';

as it is only supported in spfx framework 1.6 and above.

Is there a way to get the workbench working.

3
  • Which version of SharePoint Framework do you use? Commented Jan 16, 2019 at 17:35
  • Thank you for the reply. The SharePoint framework is 1.7.1 Commented Jan 16, 2019 at 17:39
  • are you using the following command to serve npx -p node@8 gulp serve ? (notice the number 8)
    – baywet
    Commented Jan 16, 2019 at 19:14

3 Answers 3

5

You can use nvm (node version manager) to quickly switch between different nodejs versions. Download for windows or OSX version.

How to use

  1. Install nvm
  2. $ nvm install 8.11.0 - installs nodejs version 8.11.0
  3. $ nvm use 8.11.0 - now your system uses 8.11 version of nodejs. With that version you can run gulp serve without issues.
2
  • Thank you so much for the answer. You are a life saver. Should we avoid node v10.15 completely for now. Commented Jan 16, 2019 at 23:46
  • Well, for SharePoint Framework projects yes, you should avoid, but for everything else, it's totally fine. Actually I've created a tool, which fixes SPFx project and allows you to use nodejs 10.x - the link. It's not official, but I use it and it works good. Commented Jan 17, 2019 at 5:37
1

You have to do the following:

  1. Install nvm (https://github.com/coreybutler/nvm-windows/releases)
  2. Then install the 64-Bit version for windows:
nvm install 8.9.4 64
  1. Then type the following to use the earlier version:
nvm use 8.9.4 64
  1. Then run your project as before, for example:
gulp serve

Here is more info: https://o365insights.com/downgrade-npm-for-spfx-1.7.0/

In some rare cases, doing the above still doesn't work, so it is best to find the offending .msi file in your downloads folder, for example node-v10.15.1-x64.msi, then do a right-click on it and Uninstall it. You then have to install an earlier version, such as v8.9.4. The different versions can be found here:

https://nodejs.org/download/release/

Version 8.9.4 is found here: https://nodejs.org/download/release/v8.9.4/ (for windows and other OS)

In my case, once v8.9.4 was installed, I did a gulp serve and everything started working again. Close Visual Studio Code and restart it first!

0

on windows, if not working, then delete or rename C:\Program Files\nodejs as suggested here https://stackoverflow.com/questions/47017812/nvm-use-does-not-switch-node-versions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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