Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

gulp says Local gulp not found and asks you to run npm install gulp

ErrorLocal gulp not found in <project path>

Short answer

gulp-cli is only a launcher. It looks for a copy of gulp inside the current project and stops with exit code 1 if there is none. Run npm install in the project to restore node_modules, or add gulp as a dev dependency, and start gulp from the folder that holds package.json.

  • Applies to gulp-cli 2, gulp 4, npm 10, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check where you are and what is installed there. The launcher looks in the current folder.

    pwd
    ls package.json node_modules/gulp
    gulp --version
  2. 2Match what you see, then jump to its fix

    1. 1Local modules not found in ... Try running: npm installnode_modules is missing (fresh clone or deleted folder)Fix
    2. 2Local gulp not found in ... Try running: npm install gulpgulp is not a dependency of this projectFix
    3. 3The message names a folder that is not your project root.You run gulp from a different folder than the projectFix

What does the error look like?

  • Local gulp not found in <project path>
  • Try running: npm install gulp
  • Local modules not found in <project path>
  • Try running: npm install

Cause 1 of 3

node_modules is missing (fresh clone or deleted folder)

1Check

gulp-cli checks whether package.json exists but node_modules does not. In that case it suggests the full install, and it suggests yarn if a yarn.lock is present.

ls package.json node_modules

2Fix

Install everything the project lists.

npm install
# a project with yarn.lock:
yarn install

3Verify

gulp reports both versions.

gulp --version

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 3

gulp is not a dependency of this project

1Check

node_modules exists but contains no gulp. The gulp quick start installs the command-line tool globally and gulp itself locally as a dev dependency; installing only the tool leaves the project without gulp.

npm ls gulp
npm ls --global gulp-cli

2Fix

Install gulp into the project, and the command-line tool globally if you want the plain gulp command.

npm install --save-dev gulp
npm install --global gulp-cli

3Verify

The version command shows a CLI version and a local version.

gulp --version

Confirmed by gulpjs.com

Did this fix it?

Cause 3 of 3

You run gulp from a different folder than the project

1Check

gulp-cli searches for gulp from its working directory. Running it in a parent or an unrelated folder finds nothing.

pwd

2Fix

Change into the project root, or point gulp at it with --cwd.

cd /path/to/project && gulp
# or
gulp --cwd /path/to/project

3Verify

gulp reports the CLI and local versions.

gulp --version

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Keep gulp in devDependencies so npm install always brings it back.
  • Run gulp through an npm script in CI so the working folder is always the project root.
  • Commit the lockfile so every machine installs the same gulp.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.