gulp命令行工具无法正常工作

时间:2016-10-05 19:10:45

标签: npm gulp

我最近设置了gulp但是虽然它似乎(部分)在我的IDE中工作但它似乎不能在命令行中工作。

我的package.json文件是:

{
  "name": "project",
  "version": "0.1.0",
  "dependencies": {},
  "devDependencies": {
    "browser-sync": "^2.14.0",
    "del": "^2.2.2",
    "gulp": "^3.9.1",
    "gulp-autoprefixer": "^3.1.1",
    "gulp-concat": "^2.6.0",
    "gulp-cssnano": "^2.1.2",
    "gulp-imagemin": "^3.0.3",
    "gulp-less": "^3.1.0",
    "gulp-pixrem": "^1.0.0",
    "gulp-plumber": "^1.1.0",
    "gulp-rename": "^1.2.2",
    "gulp-uglify": "^2.0.0",
    "gulp-util": "^3.0.7",
    "run-sequence": "^1.2.2"
  },
  "engines": {
    "node": ">=0.8.0"
  }
}

这些已与npm install一起安装 (但请注意我没有全局安装gulp(npm是通过OSX上的brew安装的))

运行which gulp然而我找不到gulp?

1 个答案:

答案 0 :(得分:8)

如果您可以全局安装gulp,请执行

npm install -g gulp

(可能需要sudo - 使用sudo或谷歌“修复npm权限”)

如果你不能全局安装gulp,这里有一些解决方案:
Using gulp without global gulp //edit: and without linking to the bin js file