Friday, October 13, 2017

gulp error : Error: Cannot find module '@microsoft/sp-build-web'

Error :  during new sharepoint Framework project creation you may encounter following error while creating local certificate.

C:\spfx\helloworld-webpart>gulp trust-dev-cert
module.js:471
    throw err;
    ^

Error:
Cannot find module '@microsoft/sp-build-web'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\spfx\helloworld-webpart\gulpfile.js:4:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)


Fix
: the installation don't have dependencies  try to run following command.
C:\spfx\helloworld-webpart>npm install --save-dev


Execute the command Now you will get the solution


C:\spfx\helloworld-webpart>gulp trust-dev-cert
Build target: DEBUG
[14:32:33] Using gulpfile C:\spfx\helloworld-webpart\gulpfile.js
[14:32:33] Starting gulp
[14:32:33] Starting 'trust-dev-cert'...
[14:32:33] Starting subtask 'configure-sp-build-rig'...
[14:32:33] Finished subtask 'configure-sp-build-rig' after 13 ms
[14:32:33] Starting subtask 'trust-cert'...
[14:32:39] [trust-cert] Attempting to trust a dev certificate. This self-signed certificate only points to localhost and will be stored in your local user profile to be used by other instances of gulp-core-build-serve. If you do not consent to trust this certificate, click "NO" in the dialog.
[14:32:44] Finished subtask 'trust-cert' after 11 s
[14:32:44] Finished 'trust-dev-cert' after 11 s
[14:32:45] ==================[ Finished ]==================
[14:32:45] Project helloworld-webpart version: 0.0.1
[14:32:45] Build tools version: 3.0.5
[14:32:45] Node version: v6.11.4
[14:32:45] Total duration: 20 s




No comments: