Skip to main content

Update SPFx Project

Have you come across samples in the github that you'd like to utilize but face compataibility issue with your own environment?

Easy way to upgrade the project to current​

https://pnp.github.io/cli-microsoft365/cmd/spfx/project/project-upgrade/#examples

Running into issues​

Recently, I have been trying to upgrade the beloved Adaptive Card solution and ran into some issues. Because it was a big jump from the exisitng solution (SPFx 1.12.1) to the stable SPFx 1.21.0, I had to upgrade the project in multiple steps, and endure multiplied number of issues

Here are some of the issues I have encountered and how I resolved them.

Issue 1: Rush pack compiler error after upgrading to SPFx 1.21.0​

Resolution​

Deleting the entire node_modules folder and re-installing the dependencies didn't help. @microsoft/rush-stack-compiler-3.7 upgrade to @microsoft/rush-stack-compiler-4.7 even though the SPFx 1.21 is compatible with the rush-stack-compiler 5.3.

Helpful tools​

  • Using m365 spfx doctor command to check the project health and identify potential issues was a huge help. Not only did it detect the issue, it also was useful to verify the solution compatibility with other version of the SharePoint platforms (e.g. SharePoint 2016, 2019).

Here's an example of an error detected by the doctor command:

m365 spfx doctor output:




Microsoft Guides