After installation of Gulp: “no command 'gulp' found”

后端 未结 9 2242
悲&欢浪女
悲&欢浪女 2020-11-28 17:45

After installing gulp.js via npm, I receive a no command \'gulp\' found error when running the gulp command from the same directory it was installe

9条回答
  •  臣服心动
    2020-11-28 18:36

    That's perfectly normal. If you want gulp-cli available on the command line, you need to install it globally.

    npm install --global gulp-cli
    

    See the install instruction.

    Also, node_modules/.bin/ isn't in your $PATH. But it is automatically added by npm when running npm scripts (see this blog post for reference).

    So you could add scripts to your package.json file:

    {
        "name": "your-app",
        "version": "0.0.1",
        "scripts": {
            "gulp": "gulp",
            "minify": "gulp minify"
        }
    }
    

    You could then run npm run gulp or npm run minify to launch gulp tasks.

提交回复
热议问题