安装Gulp后:“无命令'吞”发现“ [英] After installation of Gulp: “no command 'gulp' found”
问题描述
通过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
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屋!