nick van hooydonk

office 365 insights

Downgrade NPM version for SPFx 1.7.0

2018-11-13 nick van hooijdonkSPFx

Downgrading NPM Version in order to use SPFx 1.7.0.

Note: before we start I would like to anounce that I wrote this article for starting developers in SPFx that don’t use containerized environments like Docker. For the more advanced user I would like to advise using Docker.

Why do we have to downgrade?

Last weekend I was very excited about trying the new SPFx 1.7.0 release, but after giving the project a first spin I ran into the following problem:
Your dev environment is running NodeJS version v10.13.x 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

So okay… you have installed the wrong NodeJS version

My first thought was: “This makes sense! Maybe I got the current version of NodeJS instead of the LTS version.” So I went to NodejS.org to get the LTS version, but when seeing the download site the LTS version was 10.13.0.

Ask Vesa on twitter. He knows stuff!

So why does NodeJS support only an older version of NodeJS? My first thought was: When people are starting to use SPFx at this moment they get stuck at their first build already!. So I asked Vesa Juvonen on Twitter. He came with this answer:
This is a bit unfortunate, but v8 LTS is still valid until April 2019 even though by default you now get 10. We are working on the update, but needed to prioritize few dev preview capabilities first for this release.

Okay. Totally understandable, but downgrading an NodeJS version on a Windows machine is not the simplest task ever.

Enough talking, Here’s the manual

Step 1
Luckily we have the Node Version Manager for Windows (Use the nvm-setup.zip).
Install the latest version from this site. The installation is very easy. Just follow the the Setup Wizard.

Step 2
Open your favourite CMDer (I used the Windows PowerShell because I like the blue screen)
Type in the following for a 64 bits Windows:

nvm install 8.9.4 64

Now the NVM is downloading the NPM version v5.6.0. Please wait until Installation complete.

Step 3
After the installation is complete type the following in order for using the older version:

nvm use 8.9.4

Step 4
Run your project like always!