What version of Node can I use for SharePoint Framework?

What version of Node can I use for SharePoint Framework?

What version of Node.js do you need for building SharePoint Framework?

  • with the latest version of the SharePoint Framework, use the LTS version of Node.js matching the release date of your SharePoint Framework version (v12 or v10 at the time of writing this article)
  • when building projects for SP2019, use Node.js v8
  • when building projects for SP2016, use Node.js v6

Here is why.

Node.js LTS but which one

Node.js uses the concept of Long Term Support (LTS) to designate versions recommended for common use by applications.

Microsoft is committed to supporting the LTS version of Node.js available at the time of the release of the particular version of the SharePoint Framework and its Yeoman generator.

When SharePoint Framework v1.1.0 was released, the LTS version of Node.js was v6. When Microsoft released v1.4.1, the LTS version of Node was v8. At the moment of writing this article, Node.js v10 and v12 are LTS.

Even though the latest version of the SharePoint Framework Yeoman generator is capable of creating projects based on previous versions of the SharePoint Framework, the generator itself is tested with the LTS version of Node.js. Version that wasn't available when the older version of the SharePoint Framework was originally released!

In theory, things could work just fine. After all, a new version of Node.js doesn't necessarily mean introducing breaking changes. But you could end up in a situation when the generator will create a new project just fine, but the project itself won't build. Are you willing to take that risk?

Err on the safe side

If you want to lower the risk of things breaking for no apparent reason, you should stick to using the LTS version of Node.js corresponding to the version of the SharePoint Framework that you will use. After all, that's the version that it's been tested with. Should something not wrong, it will likely be due to your code and not something release to Node.js.

Comments

comments powered by Disqus