简体   繁体   English

Rails bundler:如何撤消bundle package?

[英]Rails bundler: how to undo bundle package?

How do I undo bundle package ? 如何撤消bundle package

I deleted everything in vendor/cache but it is reinstalled there when I run bundle install . 我删除了vendor/cache所有内容,但是当我运行bundle install时,它会重新bundle install

As per this answer: https://stackoverflow.com/a/9471980/219883 根据这个答案: https//stackoverflow.com/a/9471980/219883

You must delete the hidden .bundle directory, then re-run bundle install - otherwise it will continue to add the vendor/cache directory back every time. 您必须删除隐藏的.bundle目录,然后重新运行bundle install - 否则每次都会继续添加vendor/cache目录。

But if you just to remove a particular gem, then remove/comment the name of the gem from your project/Gemfile and then run bundle. 但是,如果您只是删除特定的gem,则从项目/ Gemfile中删除/注释gem的名称,然后运行bundle。

To prevent gem files from being added to the vendor/cache directory delete the vendor/cache directory from your project root. 要防止将gem文件添加到vendor / cache目录,请从项目根目录中删除vendor / cache目录。

The next time you will run bundle install gems won't create a vendor/cache folder. 下次运行bundle install时,gems不会创建vendor / cache文件夹。

Later on in your project if you need the vendor/cache folder all you'll have to do is to create the folder vendor/cache again. 如果您需要vendor / cache文件夹,则稍后在项目中,您只需再次创建文件夹vendor / cache。

$ rm vendor/cache -r
$ bundle install

Pretty late to answer, but this was happening with me too. 回答很晚,但这也发生在我身上。 You probably have hidden directory .bundle in you application root directory. 您可能在应用程序根目录中有隐藏目录.bundle Remove that directory too and then run bundle command. 也删除该目录,然后运行bundle命令。

.bundle/config is telling bundler to put things in vendor/cache . .bundle/config告诉bundler将东西放入vendor/cache Either remove the following two lines from .bundle/config or remove .bundle/config itself. .bundle/config删除以下两行或删除.bundle/config本身。

---
BUNDLE_PATH: vendor/cache
BUNDLE_DISABLE_SHARED_GEMS: '1'

Then run the following command to remove vendor/cache : 然后运行以下命令以删除vendor/cache

rm -rf vendor/cache

The next time you run bundle install you will not have this problem. 下次运行bundle install您将不会遇到此问题。

This might help as well. 这也可能有所帮助。 For more details see the documentation on bundle install 有关更多详细信息,请参阅有关bundle install的文档

bundle install --system

Bundler 1.2支持:git和:path但必须像这样明确启用它

bundle package --all

You can check your config with (under your project directory): 您可以使用(在项目目录下)检查配置:

bundle config

it outputs something like: 它输出如下:

Set for the current user (/Users/user/.bundle/config): "--with-cppflags=-I/usr/local/opt/openssl/include" 为当前用户设置(/Users/user/.bundle/config):“ - with-cppflags = -I / usr / local / opt / openssl / include”

In the config file you can check your config setting. 在配置文件中,您可以检查配置设置。

If there's no anything strange like: 如果没有什么奇怪的话:

BUNDLE_PATH: vendor/cache

You can easily remove vendor/cache directory and run bundle install again 您可以轻松删除vendor/cache目录并再次运行bundle install

In other way just remove the config variable from the file and repeat ^^ 换句话说,只需从文件中删除配置变量,然后重复^^

PS If you met gems storing under your project. PS如果您遇到了在您的项目下存储的宝石。 It's probably previous developers worked with private repos and to avoid problems with deploy and private repositories, they solved to store the gems under project directory. 可能以前的开发人员使用私有存储库并避免部署和私有存储库的问题,他们解决了将gem存储在项目目录下的问题。 So just make sure you will not break your deploy after removing the gems dir. 因此,请确保在删除gems目录后不会中断部署。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM