10

I am working on the SharePoint Framework Tutorial 1 for the Hello World Web Part. When running the build command gulp serve to build and preview the webpart I get the following error "Cannot find module '@microsoft/sp-build-web'".

Here are the details:

PS C:\src\spfm\helloworld-webpart> gulp serve module.js:327 throw err; ^ Error: Cannot find module '@microsoft/sp-build-web' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (C:\src\spfm\helloworld-webpart\gulpfile.js:4:15) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17)

I've checked the project structure and under the node_modules/@microsoft path I can see the following folders but not sp-build-web

  • sp-client-base
  • sp-client-preview
  • sp=modules-interface
  • sp-webpart-workbench

Any ideas?

2

4 Answers 4

6

Update to node package manager (npm) 3 using npm -g install npm@next and your path length issues should go away

This is because the LTS version of node ships with npm v2.x whereas npm 3.x has better package handling and doesn't create such deeply nested folders.

1
  • Great Also used npm cache and then npm i . It worked perfect! Commented Nov 21, 2016 at 13:13
4

I had the same issue when I couldn't install Phantom due to an error on their server. I fixed the issue by rerunning npm i in the command line.

1
  • 1
    It did the trick only had to run npm cache clean before npm i Commented Sep 1, 2016 at 23:11
4

Late to the party, but the only thing that worked for was:

npm install @microsoft/[email protected]

But I still get other errors and gulp serve still won't run so I give up - customizing classic was so much quicker and easier...

1
0

My corporate environment doesn't use a proxy as I couldn't be able to locate in internet explorer settings. But there are firewalls which blocks everything. I used following command and '@microsoft/sp-build-web' error was resolved.

Command: npm install --save-dev '@microsoft/sp-build-web'

I followed the web and got many resolutions but putting the above worked. Hope this helps somebody.

Thanks

1
  • Using "npm install --save-dev" resolved the issue Commented Nov 22, 2018 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.