In the past I have generated SPFx projects successfully using @microsoft/generator-sharepoint yeoman generator, but now it is not giving me the same versions for the SPFx packages. I discovered it was using the wrong versions after not being able to find MSGraphClientFactory in the project context.
Below is the package.json dependencies for the project with old versions
"dependencies": {
"react": "15.6.2",
"react-dom": "15.6.2",
"@types/react": "15.6.6",
"@types/react-dom": "15.5.6",
"@microsoft/sp-core-library": "~1.4.0",
"@microsoft/sp-webpart-base": "~1.4.0",
"@microsoft/sp-lodash-subset": "~1.4.0",
"@microsoft/sp-office-ui-fabric-core": "~1.4.0",
"@types/webpack-env": "1.13.1",
"@types/es6-promise": "0.0.33"
}
Below is the package.json dependencies for the project with correct versions
"dependencies": {
"@microsoft/microsoft-graph-types": "^1.12.0",
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@microsoft/sp-property-pane": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@types/es6-promise": "0.0.33",
"@types/react": "^16.9.32",
"@types/react-dom": "^16.9.6",
"@types/simplebar": "^5.1.1",
"@types/webpack-env": "1.13.1",
"axios": "^0.19.2",
"bluebird": "^3.7.2",
"office-ui-fabric-react": "6.189.2",
"react": "16.8.5",
"react-dom": "16.8.5",
"simplebar-react": "^2.1.0"
}
Notice that the versions should be 1.10.0 but they are being set to ~1.4.0.
Below is the result I get after running npm ls -g --depth=0
+-- @microsoft/[email protected]
+-- @pnp/[email protected]
+-- [email protected]
`-- [email protected]
I tried running npm install @microsoft/generator-sharepoint@latest -g as well as updating the generator through Yeoman, but no luck.
I have not changed any of my choices when creating the project. I choose SP Online and I use React as the framework.
If anyone can help me get the correct package versions downloading it would be greatly appreciated, thanks.