如果在gulpfile.js以外的其他文件夹中安装gulp(node

编程入门 行业动态 更新时间:2024-10-26 14:40:59
本文介绍了如果在gulpfile.js以外的其他文件夹中安装gulp(node_modules),如何运行gulp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在一个目录中有gulpfile.js,在另一个目录中有node_modules。 当我运行gulp时,我得到了错误 - '在'..(目录)中找不到本地gulp .. 尝试运行:npm install gulp'

I have gulpfile.js in one directory and node_modules in another. When I run gulp, i get the error - 'Local gulp not found in '..(the directory).. Try running: npm install gulp'

问题是 - 我不能在gulpfile.js的目录中安装gulp,所以我需要一种方法告诉gulp参考其他目录,我已经安装了gulp。

The thing is - I cannot install gulp in the directory of gulpfile.js and so I need a way to tell the gulp to refere to the other directory i have gulp installed in.

推荐答案

如果您不想要,您不需要全局安装gulp。你可以做的是运行你的gulp可执行文件(从你的node_modules),然后使用 - gulpfile 参数传入你的gulp文件的位置。另外,如果你想控制你的gulp运行的位置,可以使用 - cwd 参数。

You don't need to install gulp globally if you don't want to. What you can do is run your gulp executable (from your node_modules) and then pass in the location of your gulpfile using the --gulpfile parameter. Also, if you want to control where your gulp is running, make use of the --cwd parameter.

下面是一个例子: p>

Here's an example:

<NODE_MODULES DIR>/gulp/bin/gulp.js --gulpfile <GULP FILE> --cwd <SOME DIR>

更多推荐

如果在gulpfile.js以外的其他文件夹中安装gulp(node

本文发布于:2023-11-14 16:35:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1587972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   夹中   js   gulpfile   gulp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!