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

白昼怎懂夜的黑 提交于 2019-12-03 04:00:38

问题


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

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?


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/38103889/local-gulp-not-found-try-running-npm-install-gulp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!