Forum Discussion

Arun Aggarwal's avatar
Arun Aggarwal
Copper Contributor
Jan 29, 2019
Solved

Error - Local gulp not found in project directory while running a spfx sample application


Hi

I need some help in running a sample SharePoint Framework project.

It used to be so easy to develop in Visual Studio since you only had to write some code but VS took care of everything else to build your application from your code. In SPFX you have to manage so many different tools with different versions that sometime it becomes overwhelming.

Here are the details of my environment.

1) Node.js v 8.11.4

2) spfx - 1.7.0 (Sample application)

3) gulp CLI version 2.0.1 (Global Install)

 

I have done a "npm install" to install the dependencies for the project. However when I try to run the application, I get an error " Local gulp not found in project dir". Try running : npm install gulp. I tried the suggested command "npm install gulp" to do the local install of the gulp even though I have the global install of the gulp. This did not help.

I looked at the node_modules in the VS code and I cannot decode it to understand if gulp is there in the local dependency list or not.

I have tried google and everyone has a different suggestion to solve this problem. Nothing seems to help.

If someone can give me a tip or share their experience, I will really appreciate it.

Thanks in advance

-Arun

  • I had to delete the following files from the project folder for "npm install" to work correctly to install the dependencies.

    1) package-lock.json,

    2) yarn.lock &

    3) shrinkwrap.yarn

    Thanks to Andrew Connell for his advise. I tried everything what is available on the net and nothing helped. Hope it helps you.

     

6 Replies

  • As Joel mentioned, it seems like you might be in the wrong folder. If you run the yo command and choose the option to create a folder for the project, you are left in the wrong folder. Make sure you run the gulp command from the same folder that package.json is located.

    My recommendation is always to create the folder (mkdir), switch to that folder (cd), then run the yo command.

    What version of SPFx are you using? I just ran the yo command and used the create folder command. The result was a project that was not properly created, so you might have helped uncover a bug!
  • Arun Aggarwal's avatar
    Arun Aggarwal
    Copper Contributor

    I had to delete the following files from the project folder for "npm install" to work correctly to install the dependencies.

    1) package-lock.json,

    2) yarn.lock &

    3) shrinkwrap.yarn

    Thanks to Andrew Connell for his advise. I tried everything what is available on the net and nothing helped. Hope it helps you.

     

  • Hi Arun,

    I would start by deleting the node_modules folder on the project and run npm install again. Ensure you do this in the project folder as well - I remember I did this mistake once as I had 2 folders with almost identical names :)
    SPFx has a dependency on gulp, so it should get installed when you run npm install

    Hope this helps, but please reply with additional details if not

    Joel

Resources