How to check SharePoint Framework version


Here is how you can check what version of the SharePoint Framework you’re using:

  1. Before creating a project:
    • in the command line execute npm ls -g --depth=0
    • check the version of the @microsoft/generator-sharepoint package
    • if you don’t see it, try executing npm ls --depth=0
    • if you still don’t see it, you don’t have the SharePoint Framework Yeoman generator installed
  2. In your project:
    • open the package.json file,
    • check the version of the @microsoft/sp-core-library package
  3. In your package (.sppkg):
    • unpack the .sppkg file (it’s actually a .zip)
    • open one of the manifest files (.json)
    • check the version of the @microsoft/sp-core-library component

Why would you care

Now that you know how you can check the version of the SharePoint Framework that you’re using, it’s time for a more important question: Why would you care?.

Why should you care about the SharePoint Framework version before creating a project

There are different versions of the SharePoint Framework available for you to use. Between these versions, there are three main streams: version that’s supported on SP2016, version that works on SP2019 and version that works on SharePoint Online.

SharePoint Online supports any version of the SharePoint Framework. So while you don’t necessarily need to care about which version you’re using, the latest version is likely to offer you the most benefits and capabilities. SharePoint 2019 supports SharePoint Framework up to and including v1.4.1. Finally, SharePoint 2016, support SharePoint Framework up to v1.1.0.

So before you create a project, you should know with which version of SharePoint, your solution will be used and choose the right version accordingly.

Why should you care about the SharePoint Framework version once you have a project

It’s rarely the case, that you scaffold the complete project on day 1 and all you need to do afterward is to fill the generated files with code. On the contrary. As your project progresses, the requirements change, and you might need to create additional web parts and extensions in your project.

To avoid issues, you should use the SharePoint Framework Yeoman generator that’s aligned with the version of the SharePoint Framework that you’re using. If you use a different version, there is a risk that the generated files will not be compatible with the rest of your project and you will waste a lot of time trying to fix them. An easy way to avoid is to install the SharePoint Framework Yeoman generator as a dev dependency in your project or to use Docker images with the version matching your project.

Why should you care about the SharePoint Framework version once you have a package

When you’re tasked with deploying a SharePoint Framework solution to production and someone hands you over a package, you should first check if it will be supported in your SharePoint environment. If you’re on SharePoint Online, there is less concern about the SharePoint Framework version, since any version would work really, but still, you might want to check if your supplier uses a recent version that might be easier to support if necessary.

If you’re using SharePoint on-premises, your server-side dependencies are locked to a specific version of the SharePoint Framework. If you try to deploy a package built using a newer version, the deployment will fail with an error unnecessarily costing you time and effort. You can be ahead of it by checking the version of the SharePoint Framework used by the package before deploying it.

Others found also helpful: