Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active June 12, 2022 15:31
Show Gist options
  • Save plembo/1714a92031faaf3aa44f2907911302b4 to your computer and use it in GitHub Desktop.
Save plembo/1714a92031faaf3aa44f2907911302b4 to your computer and use it in GitHub Desktop.
Setup a SharePoint Framework Dev Environment

Setup a SharePoint Framework Dev Environment

With notes related to PnP Microsoft 365 Community development.

Introduction

It's important to keep up with the documentation and bug reports in this, especially with regard to the versions of node.js and npm that will work with a given solution. There is presently no uniformity in this area. The notes below reflect the current (as of 14 Nov 2021) state of play as I understand it.

Some notes on why you shouldn't plan on doing much SharePoint Framework development on Linux:

  1. Some projects may require dependencies, like PowerShell modules, that cannot run on Linux. In particular, the SharePoint Online Management Shell and related modules will only run on Windows (on PowerShell 5, as admin, and not at all on PowerShell 7+). The same is true of the PowerShell modules for Power Platform. Just because something will install doesn't mean it will run (most of the time due to missing Win32 DLLs or Windows Registry keys).

  2. An important part of the development workflow is launching a gulp web server in your local project folder and then accessing it though the SharePoint Framework Workbench (https://[tenantname].sharepoint.com/_layouts/workbench.aspx) on your tenant. For reasons unknown, this doesn't work on Linux (the Workbench doesn't think the local web server is running, even when the self-signed development cert is loaded).

If you're looking for some hints on how to get around that second problem, look at this article: Darren Xu. "Setting up a SPFX project on Ubuntu". Darren's Blog, 15 May 2021, https://blog.darrenxu.com/setting-up-a-spfx-project-on-ubuntu/. Personally, I just use a Windows virtual machine on KVM.

What to install

Always start with the documentation because things are subject to change at any time:

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment

Basic Checklist

  • Node.js v14.18.1 (use nvm for Windows to manage multiple versions and maintain your sanity: you have been warned!)
  • Use npm v8.1.3 for node.js v14.18.1 and newer, npm v6.14.2 for node.js v10.24.1. Do not update!
  • Gulp (npm install -g gulp-cli)
  • Yeoman (npm install -g yo)
  • SharePoint Generator (npm install -g @microsoft/generator-sharepoint)
  • Dev certificate (gulp trust-dev-cert)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment