-
Notifications
You must be signed in to change notification settings - Fork 1k
Local gulp not found #3575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible. |
Following advise I found in Stack Overflow, I executed "npm link gulp". Now when executing gulp serve or gulp trust-dev-cert I get the following error: C:\Users\ferna\source\helloworld>gulp trust-dev-cert Error: Cannot find module '@microsoft/sp-build-web' |
I finally managed, it took me long enough. These are the steps I did to solve the problem, should anyone find him/herself in the same position.
From what I could gather, the problems are related to invalid cache (i.e. the way npm/yo are supposed to get packages from online repository) and problems with the way these tools are installed in Windows (they were written originally for Linux), hence the need of manually going through those additional commands. I really hope one day SPFx will be available for Visual Studio instead of relying on (bugged?) third party tools. After all, we pay lots of dollars for our VS subscription! Hope this helps someone to troubleshoot their installation. [1] https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part |
The typical reason for this is because you didn't run To be clear:
That is not required or expected you have to do that. Gulp is special in that you need it installed globally & locally. The steps only have you install it globally because the default scaffolding generated by SPFx's Yeoman generator sets it up for local install. |
Hi Andrew, thank you for your comment. I did follow the step-by-step procedure depicted in the documentation. I did ran "npm install -g yo gulp" and "npm install -g @microsoft/generator-sharepoint". Then the doc says to run "gulp trust-dev-cert". There's a note below that reads "This assumes you have installed all dependencies with npm install after creating the project. This step will install all gulp tasks as part of a project." If this refers to what you say, then I would suggest to add something more descriptive. Specifically, if the doc is going on a step by step basis, it would be better if a previous step to "gulp trust-dev-cert" was "npm install" with the explanation you gave me, and before, not after. It might save trouble for a lot of people who, like me, are having to learn three of four new tools to do stuff that previously only needed a "press F5 to run" in Visual Studio. Thanks again! |
Not sure you understood what I was saying. When you follow the setup instructions here: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment ... you get to the part where it talks about Trust the self-signed developer certificate. It states:
The part I italicized is the important piece. In that tutorial, the one you linked to, after step 5 the steps say
That's the key... once you have created the project & the dependencies have been installed, only then can you run The steps are pretty clear... you install install some tools (gulp, yeoman and the SPFx yeoman geneartor) globally. The next step is to trust the dev cert, but that must be done from a project so you create a project and once it's been provisioned and all dependencies have been created, you can trust the dev cert. |
Hello Andrew, thanks for your input. However, I'm not sure you understand the problem I had. I did follow the instructions to the letter, and not once, but many times. I reached the part "At this point, Yeoman installs the required dependencies and scaffolds the solution files along with the HelloWorld web part. This might take a few minutes." of the tutorial. After the few minutes and Yeoman did whatever it is it does, I tried to run the "gulp trust-dev-cert" and it failed. Again and again. It wasn't until I ran "npm link gulp" that the error was removed (and replaced by other set of errors, as I documented here). You say that step is not needed, and I believe you. But only then it worked for me, despite running the instructions as they are written. Perhaps it is a bug? Or something lacking in my environment? Honestly, I cannot tell, I don't know these tools to venture an opinion. |
Nope... fully understand the problem. What you did should NOT be required. After the dependencies are installed, if you are in the same root folder in the project, you should now have a |
Clearing the npm cache and running npm install worked for me npm cache clean --force then run npm install |
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues |
Category
I'm following the instructions of the article[1], however executing the command "gulp trust-dev-cert" or "gulp serve" I get the following error:
C:\Users\ferna\source\helloworld-webpart>gulp trust-dev-cert
[15:44:57] Local gulp not found in ~\source\helloworld-webpart
[15:44:57] Try running: npm install gulp
I already installed gulp through the previous "npm install -g gulp" command, but I run the command again (this time without the -g as specified by the suggestion, and I get the same error. Any suggestion as to why is this happening? I made sure "C:\Users\ferna\AppData\Roaming\npm" is on PATH, but still get the same result...
[1] Articles:
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment
On a related note, will there be ever a version of SPFx for Visual Studio that just works with one click, as with previous versions of SharePoint?
The text was updated successfully, but these errors were encountered: