跳过本地安装 Gulp [英] Skip local installation of Gulp

查看:36
本文介绍了跳过本地安装 Gulp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以以某种方式跳过 Gulp 的本地安装到项目吗?

Can I somehow skip local installation of Gulp to the project?

我全局安装了 Gulp,将它作为依赖添加到 package.json 中.但是仍然希望在本地安装 Gulp,并且带有 Local gulp not found in ... 消息.如果我进行本地安装,Gulp 会按节点复制到我的项目中.

I installed Gulp globally, added it to package.json as a dependency. But still Gulp wants to be installed locally also with the Local gulp not found in ... message. If I do local install, Gulp is copied into my project by node.

有没有办法跳过 Gulp 的本地安装?我希望能够从命令行在整个服务器上运行它并全局管理它的安装.

Is there a way to skip local installation of Gulp? I want to be able to run it across the whole server from command line and manage it installation globally.

推荐答案

一种干净的方法是在没有本地安装它的情况下像您一样全局安装 gulp,然后在您的目录中运行命令:

One clean way to do this is without have it locally is to install gulp globally like as you did and then run in your directory the command :

npm link gulp

它将在您的 node_modules 文件夹中创建一个符号链接到您的全局 gulp 安装.您需要小心版本,因为您的所有符号链接以及您的本地项目都将使用全局符号链接,无论 package.json 中定义的版本如何,这都可能导致错误部署环境.

It will create a symbolic link in your node_modules folder to your global gulp install. You need to be careful on the versions since all your symlinks and therefore your local project(s) will use the global one, no matter of the defined version in the package.json, which could cause errors on a deployed environment.

这也适用于每个节点包,并允许您一次更新以这种方式创建的多个项目的本地安装.

This is also applicable for every node package, and allow you to update the local install you've created that way of multiple projects at once.

这篇关于跳过本地安装 Gulp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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