Skip to main content

spfx doctor

Verifies environment configuration for using the specific version of the SharePoint Framework

Usage

m365 spfx doctor [options]

Options

-e, --env [env]

Version of SharePoint for which to check compatibility: sp2016|sp2019|spo

-v, --spfxVersion [spfxVersion]

Version of the SharePoint Framework Yeoman generator to check compatibility for without v, eg. 1.11.0

-h, --help

output usage information

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples

-o, --output [output]

Output type. text or json. Default text

--verbose

Runs command with verbose logging

--debug

Runs command with debug logging

Remarks

This commands helps you to verify if your environment meets all prerequisites for building solutions using a particular version of the SharePoint Framework.

The command starts by detecting the version of SharePoint Framework that you want to use. First, it looks at the current project. If you didn't run the command in the context of a SharePoint Framework project, the command will try to determine the SharePoint Framework version based on the SharePoint Framework Yeoman generator that you have installed either in the current directory or globally.

Based on the determined version of the SharePoint Framework, the command will look at other dependencies such as Node.js, npm, Yeoman, Gulp CLI and TypeScript to verify if their meet the requirements of that particular version of the SharePoint Framework.

If you miss any required tools or use a version that doesn't meet the SharePoint Framework requirements, the command will give you a list of recommendation how to address these issues.

Next to verifying the readiness of your environment to use a particular version of the SharePoint Framework, you can also check if the version of the SharePoint Framework that you use is compatible with the specific version of SharePoint. Supported versions are sp2016, sp2019 and spo.

info

Checks ran by this command are based on what is officially supported by Microsoft. It's possible that using different package managers or packages versions will work just fine.

info

This command supports only text or json output.

Examples

Verify if your environment meets the requirements to work with SharePoint Framework based on the globally installed version of the SharePoint Framework Yeoman generator or the current project

m365 spfx doctor --output text

Verify if your environment meets the requirements to work with the SharePoint Framework and also if the version of the SharePoint Framework that you're using is compatible with SharePoint 2019

m365 spfx doctor --env sp2019 --output text

Verify if your environment meets the requirements to work with SharePoint Framework v1.11.0

m365 spfx doctor --spfxVersion 1.11.0 --output text

Verify if your environment meets the requirements to work with SharePoint Framework v1.11.0 and outputs it in a JSON format.

m365 spfx doctor --spfxVersion 1.11.0 --output json

Response

Response with no issues

[
{
"check": "SharePoint Framework",
"passed": true,
"version": "1.18.2",
"message": "SharePoint Framework v1.18.2 valid."
},
{
"check": "SharePoint Framework",
"passed": true,
"version": "1.18.2",
"message": "SharePoint Framework v1.18.2"
},
{
"check": "env",
"passed": true,
"message": "Supported in SPO",
"version": "spo"
},
{
"check": "Node",
"passed": true,
"message": "Node v18.18.2",
"version": "18.18.2"
},
{
"check": "yo",
"passed": true,
"message": "yo v5.0.0",
"version": "5.0.0"
},
{
"check": "gulp-cli",
"passed": true,
"message": "gulp-cli v2.3.0",
"version": "2.3.0"
},
{
"check": "typescript",
"passed": true,
"message": "bundled typescript used"
}
]

Response with issues reported

When the installed version of Yeoman is lower than expected to run SharePoint Framework v1.15.0

[
{
"check": "SharePoint Framework",
"passed": true,
"version": "1.15.0",
"message": "SharePoint Framework v1.15.0 valid."
},
{
"check": "SharePoint Framework",
"passed": true,
"version": "1.15.0",
"message": "SharePoint Framework v1.15.0"
},
{
"check": "env",
"passed": true,
"message": "Supported in SPO",
"version": "spo"
},
{
"check": "Node",
"passed": true,
"message": "Node v16.18.0",
"version": "16.18.0"
},
{
"check": "yo",
"passed": false,
"message": "yo v3.1.1 found, v^4 required",
"version": "3.1.1",
"fix": "npm i -g yo@4"
},
{
"check": "gulp-cli",
"passed": true,
"message": "gulp-cli v2.3.0",
"version": "2.3.0"
},
{
"check": "typescript",
"passed": true,
"message": "bundled typescript used"
}
]
CTRL + M