@microsoft/generator-sharepoint update check failed

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

Microsoft generator sharePoint update check failed
Microsoft generator sharePoint update check failed

From the above warning, we can easily get to know that the yo and generator-SharePoint package update failed.

See also  Cannot find module '@microsoft/sp-build-web'

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.

microsoft generator sharepoint update check failed in spfx
Microsoft generator sharepoint update check failed in spfx

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.

microsoft generator sharepoint update check failed in spfx issue
microsoft generator sharepoint update check failed in spfx issue

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.

See also  a 'primitive value' or 'StartObject'node was expected

When I first time run the command, I came across the below error: ‘Error – ‘trust-cert’ subtask’, you can see in the screenshot.

Can't install SPFx Certificate on my windows 10 machine
Can’t install SPFx Certificate on my windows 10 machine

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:

>