SharePoint Framework - SPFx Development With SharePoint 2016


SharePoint Framework (SPFx) is popular for developing the solutions for modern sites in SharePoint Online. However, it is not only limited to the cloud environment. SharePoint Framework development is also supported on SharePoint OnPremise environment (SharePoint 2016 onwards).
In this article, we will explore how we can get our SharePoint 2016 OnPremise environment ready for SharePoint Framework and start developing SPFx client web parts.

Decide Upon SharePoint Framework Version

SharePoint Online follows frequent release cycles as compared to SharePoint OnPremise versions. SharePoint online always uses the latest version of SharePoint Framework. On the other hand, SharePoint 2016 only supports the version with matching server-side dependencies.

Get SharePoint 2016 OnPremise Ready for SPFx

Install SharePoint 2016 Feature Pack 2
In order to get the SharePoint 2016 OnPremise ready for SharePoint Framework development, we need to first install “SharePoint 2016 Feature Pack 2” on the server. If your SharePoint server has a working internet connection and automatic Windows updates are ON, then this should get applied to your server as a part of Windows Update.
Install NodeJS
  • Install the latest LTS version from here.
  • If you already have NodeJS installed, check the version.
  1. node -v  
Install Code Editor
Install any of the below code editors.
  • Visual Studio Code
  • Atom
  • Webstorm
Install Yeoman and gulp
Run the below command.
  1. npm install -g yo gulp   
Install Yeoman SharePoint Generator
Run the below command.
  1. npm install -g @microsoft/generator-sharepoint  

Develop SharePoint Framework Web Part

Open the command prompt. Create a directory for SPFx solution.
  1. md spfx-onprem-hello-world  
Navigate to the above-created directory.
  1. cd spfx-onprem-hello-world  
Run Yeoman SharePoint Generator to create the solution.
  1. yo @microsoft/sharepoint  
Yeoman generator will present you with the wizard by asking questions about the solution to be created.
Solution Name: Hit Enter to have a default name (spfx-onprem-hello-world in this case) or type in any other name for your solution.
Selected choice: Hit Enter
Target for component: Here, we can select the target environment where we are planning to deploy the client webpart, i.e., SharePoint Online only (latest) / SharePoint 2016 onwards, including 2019 and SharePoint Online / SharePoint 2019 onwards, including SharePoint Online.
Selected choice: SharePoint 2016 onwards, including 2019 and SharePoint Online
Place of files: We may choose to use the same folder or create a subfolder for our solution.
Selected choice: Same folder
Deployment option: Selecting Y will allow the app to deployed instantly to all sites and will be accessible everywhere.
Selected choice: N (install on each site explicitly)
Type of client-side component to create: We can choose to create a client-side webpart.
Selected choice: WebPart
Unless it is SharePoint Online, we do not have an option to create SharePoint extensions in SharePoint OnPremise 2016 version using SPFx generator.
Web part name: Hit Enter to select the default name or type in any other name.
Selected choice: OnPremHelloWorld
Web part description: Hit Enter to select the default description or type in any other value.
Selected choice: SPFx on SharePoint 2016
Framework to use: Select any JavaScript framework to develop the component. Available choices are No JavaScript Framework, React, and Knockout.
Selected choice: React
Yeoman generator will perform scaffolding process to generate the solution. The scaffolding process will take a significant amount of time.
Once the scaffolding process is completed, lock down the version of project dependencies by running the below command.
  1. npm shrinkwrap  
In the command prompt, type the below command to open the solution in code editor of your choice.
  1. code .  

Run the SPFx WebPart

  1. On the command prompt, type “gulp serve”.
  2. Open SharePoint site.
  3. Navigate to /_layouts/15/workbench.aspx.
  4. Add the webpart to the page.


Below are a few common issues and resolutions.
Issue# 1: Workbench does not load
Although you have everything installed and correctly set up, you might face the below issues on running “gulp serve”.
Internet Explorer
Google Chrome
In the command prompt, run the below command to resolve the issue.
  1. set NODE_NO_HTTP2=1   
Issue# 2 -  
“gulp serve” is not running
In some cases, the SharePoint workbench (https://[tenant] shows below error although “gulp serve” is running.
Open this URL in the next tab of the browser. Accept the warning message.


For the future compatibility of the solution, it is recommended to start using SharePoint Framework based development in SharePoint OnPremise. Also, duly note that SPFx solutions created for SharePoint Online might not work for SharePoint OnPremise.