Local gulp not found (Try running: npm install gulp)

NpmGulpNpm InstallPost Install

Npm Problem Overview


I created a module (webapp-module-storage) which has the following definitions:

package.json

{
  "dependencies": {
    ...
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    ...
  },
  "name": "webapp-module-storage",
  "scripts": {
    "postinstall": "gulp build",
    "test": "gulp test"
  }
}

I thought I can use my module inside another module when installing it with:

  • npm install github:myorg/webapp-module-storage#master

However, when I install my module, I am getting this error:

> Local gulp not found > > Try running: npm install gulp

Screenshot

enter image description here

My understanding is, that gulp is shipped together with my module because I declared it in devDependencies but it looks like that my npm postinstall script cannot find gulp.

Am I missing something?

Npm Solutions


Solution 1 - Npm

Try running npm link gulp in your application directory (to create a local link to the globally installed Gulp module).

Solution 2 - Npm

Try installing your dependencies first:

npm install

If still does not work, install gulp globally:

npm install -g gulp

if you find problems installing it. type sudo before npm.

In case you need more info about why you need gulp globally and locally read this answer

Solution 3 - Npm

I have tried all the solutions mentioned. At the end I was able to solve the problem by realising that the gulpfile.js file was missing on the location i was using the gulp. After placing the gulpfile.js in the folder from where I was executing gulp, it worked for me.

Solution 4 - Npm

npm link gulp --no-bin-links
Run this

where npm link gulp creates a local link to globally installed gulp module and --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain.

You can't translate symlinks to a synchronized folder on Windows share, so you will need '--no-bin-links' to go around it.

Use it for any filesystem that doesn’t support symbolic links.

Symlinks, or symbolic links, are “virtual” files or folders which reference a physical file or folder located elsewhere, and are an important feature built in to many operating systems, including Linux and Windows.

Solution 5 - Npm

npm link gulp --force

Using this command worked well for me.

Solution 6 - Npm

Put Gulp into the regular dependencies of the project:

npm i gulp

And then have your scripts section reference the local Gulp like that:

  "scripts": {
    "postinstall": "./node_modules/.bin/gulp build",
    "test": "./node_modules/.bin/gulp test"
  }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBenny NeugebauerView Question on Stackoverflow
Solution 1 - NpmFab FuersteView Answer on Stackoverflow
Solution 2 - NpmSebastian SView Answer on Stackoverflow
Solution 3 - NpmKapil BhagchandaniView Answer on Stackoverflow
Solution 4 - NpmParikshit SinghView Answer on Stackoverflow
Solution 5 - NpmAgostinho de Pina RamosView Answer on Stackoverflow
Solution 6 - NpmleymannxView Answer on Stackoverflow