In this SharePoint framework tutorial, I will discuss how to resolve error as: cannot find module ‘@microsoft/sp-build-web’ which comes in SharePoint Framework (SPFx).
Here we will discuss various approaches to solve gulp trust-dev-cert error: cannot find module ‘@microsoft/sp-build-web’ SharePoint Framework (spfx) error.
If you are new to the popular SharePoint framework (spfx) development, then you can check out below tutorials where I have explained in detail how to set up your development environment for spfx and how to create your first client web part using spfx.
I have also created a video tutorial for the same:
While I was working on a SharePoint Framework to build a web part for SharePoint Online modern site, I was executing the command as “gulp trust-dev-cert” using SharePoint 2016 Management Shell. But it throws an error as cannot find module ‘@microsoft/sp-build-web’. You can see that SharePoint Framework error in the below screenshot.

Here we will discuss various solutions to solve the cannot find module ‘@microsoft/sp-build-web’ error.
Cannot find module ‘@microsoft/sp-build-web’ SPFx
To solve this SharePoint Framework error, I ran the command as “npm install @microsoft/sp-build-web@1.6.0” in the SharePoint 2016 Management Shell. Then the command successfully executed and the problem solved.

If the above solutions did not work, try the below solutions which may work for you.
gulp trust-dev-cert error: cannot find module ‘@microsoft/sp-build-web’
Another important thing you can check which version of NodeJS you have installed, It should be Install NodeJS v8.11.4. This is the version which is supported. Do not install the latest version of NodeJS unless communicated from SPFx team.
gulp error: Cannot find module ‘@microsoft/sp-build-web’
If the issue still did not resolve, you can try the below solution which was suggested by Prabhu.
Run the below command:
npm i
Cannot find module ‘@microsoft/sp-build-web gulp error
Another solution you can try, run the below command:
npm install --save-dev
or
npm install --save
The difference between –save and –save-dev is, –save-dev is used to save the package for development purpose only and –save is used to save the package for the application.
Error: Cannot find module ‘@microsoft/sp-build-web’
To resolve Error: Cannot find module ‘@microsoft/sp-build-web’, you can try the below solution also.
npm install --save-dev '@microsoft/sp-build-web'
Once run the command, you can delete your existing old web part folder and recreate everything using Yeoman.
You can also check the below SharePoint framework tutorials:
- [Solved] [spfx-serve] The api entry could not be loaded: node_modules/@microsoft/sp-webpart-workbench/lib/api/ in SharePoint Framework
- Setup SharePoint Framework (SPFx) development environment in Windows 10 workstation
- how to create SPFx webPart with ReactJS for SharePoint 2016 On-Premise environment
- [Solved] SPFx multiline textbox field rending as a single line of text in SharePoint Online
- [Resolved] SharePoint framework Local Workbench is showing empty
- Provision list using SharePoint framework
- Can’t load the application on this page SPFx Microsoft Teams
I hope this SharePoint Framework article will be helping you to resolve cannot find module ‘@microsoft/sp-build-web’ spfx error.
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 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
Thank you so much, it saved my day!