After upgrading SharePoint Framework (SPFx) to the latest version, there still might be a chance for getting into trouble even if you have done everything by the books. An by the books I of course refer to using the excellent project upgrade tool from the Microsoft 365 CLI (https://pnp.github.io/cli-microsoft365/cmd/spfx/project/project-upgrade/).
Example of error message after running a “gulp build”:
Error - [tslint] The 'member-access' rule threw an error in ...
Tips to solve this
- You could have forgotten one of the steps in the upgrade report, so it is time to double check.
- Create a blank project from scratch to compare essential files like the tslint.json, tsconfig.json etc where it is easy to make mistakes between the versions
- Make sure you have a clean copy of you packages by deleting “package-lock.json” and the folder node_modules. Run new install of your packages with npm install and build the project with gulp build again.
- Check you package.json for issues with you packages. My most common mistake at the ends is to forget to remove old TypeScript versions when new ones are added by the upgrade script: