安装Gulp后:“无命令'吞”发现“ [英] After installation of Gulp: “no command 'gulp' found”

查看:119
本文介绍了安装Gulp后:“无命令'吞”发现“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过npm安装 gulp.js 后,我收到一个 no命令'gulp'found





















$ b node_modules / .bin / 目录下查看时,可以看到 gulp 可执行文件。



我的npm安装有问题吗?

解决方案

这很正常。
如果您希望在命令行中提供 gulp-cli ,则需要全局安装它。

  npm install --global gulp-cli 

请参阅安装说明



另外, node_modules / .bin / 不在您的 $ PATH 中。但是在运行npm脚本时它会自动添加npm(请参阅此博客文章以供参考)。



因此,您可以将脚本添加到 package.json file:

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

您可以运行 npm run gulp npm运行minify 来启动gulp任务。


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 installed into.

When looking under the node_modules/.bin/ directory, I can see the gulp executable there.

Is there something wrong with my npm installation?

解决方案

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.

这篇关于安装Gulp后:“无命令'吞”发现“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆