First published on TECHNET on Jul 17, 2018 This post is a contribution from Aravinda Devagiri, an engineer with the SharePoint Developer Support team
Recently I worked on a case, while trying to build simple Client Side webpart, when we run the gulp trust-dev-cert to install developer certificate (to preview the webpart) we get the error.
Error: Cannot find module '@microsoft/sp-build-web' at Function.Module._resolveFilename (module.js:527:15) at Function.Module._load (module.js:476:23) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object.<anonymous> (D:\bin\helloworld-webpart\gulpfile.js:4:15) at Module._compile (module.js:624:30) at Object.Module._extensions..js (module.js:635:10) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) at Function.Module._load (module.js:500:3)
The most probable reason could be that the you are working behind corporate proxy. You have to setup node.js and get npm to work behind a proxy by setting the proxy and https-proxy settings.
Below are the commands to configure proxy setting for node.js.