In this Spfx tutorial, I have explained how to fix the warning @microsoft/generator-sharepoint update check failed which comes while creating an spfx client-side web part. And also I will show you how to fix the issue Can’t install SPFx Certificate on a windows machine.
@microsoft/generator-sharepoint update check failed
Here are the steps I was following and I got the error.
I was creating a client-side web part using spfx.
To create our first web part, we first created a directory in our C:/ drive. For this task, we will open the command prompt in our system and run the following commands.
C:\Users\tsinfo>cd ..
C:\Users>cd ..
C:\>md Project
C:\>cd Project
C:\Project>md FirstWebpart
C:\Project>cd FirstWebpart
Now, we will create our first web part inside the webparts directory. However, while creating the SharePoint first web part, I came across the below issues after running the below command:
yo @microsoft/sharepoint
When you run the above command, the Yeoman generator will prompt the list of questions. For those questions choose the default answer.
What is your solution name? first-webpart
Which type of client-side component to create? WebPart
What is your Web part name? HelloWorld
Which template would you like to use? No framework
The command ran successfully and my first web part ‘first-webpart’ was created successfully, with the below warning
From the above warning, we can easily get to know that the yo and generator-SharePoint package update failed.
Reason & Solution for @microsoft/generator-sharepoint update check failed warning
The main reason behind this warning is the lack of access. In the above implementation, we are using the command prompt without any administrative access. However, to overcome the above warning, we just need to use the command prompt with the Administrative rights.
So, run your command prompt or PowerShell as
So the solution for this we need to delete the whole directory where we have created the First web part. In my case, I have created it in the c drive, either locate it in the C drive and delete the whole project directory, or else write the below command to remove the directory. Once you remove the directory, close the command prompt.
C:\Project\FirstWebpart>cd ..
C:\Project>cd ..
C:\>rmdir /s Project
Now open the command prompt or Power Shell as ‘Run as administrator’ like the below screenshot. Then one window pop ‘ Do you want to allow this app to make a change in this device’, so, click on Yes.
Now create the directory and run the yeoman SharePoint generator command mentioned to create the first web part.
C:\Project\FirstWebpart>yo @microsoft/sharepoint
Now this command will ask some questions that we have already discussed before. Once it runs successfully, you can see the warning is resolved.
Can’t install the SPFx trust certificate using gulp trust-dev-cert on my windows 10 machine
While creating my first web part, I skipped the above warning, and jump to the next step to install the certificate by using the below command.
gulp trust-dev-cert
So the above command runs once when you first time creating your web part, to certify the developer environment.
When I first time run the command, I came across the below error: ‘Error – ‘trust-cert’ subtask’, you can see in the screenshot.
So to resolve the above error, the solution is the same as above, we need to run the command prompt or PowerShell as ‘Run as administrator. Then create your first web part and if we will run the above command, it will install the certificate for your development environment.
Conclusion
In this spfx tutorial, we resolve the below two issues, while creating a web part using SharePoint Framework. This problem will occur if you do not execute the command prompt or powershell as administrator.
- @microsoft/generator-sharepoint update check failed
- Can’t install the SPFx trust certificate using gulp trust-dev-cert on windows 10/11
You may like the following spfx tutorials:
- SPFx Fluent UI Basic List Example
- SPFx fluent UI react dropdown example
- SPFx Send Email using PnP
- Display SharePoint list items using SPFx
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com