我在一个目录中有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
发布评论