下面是我需要做的。

要运行规范,需要安装RSpec。首先,在项目的根目录下运行gem install bundler。然后,运行bundle install。要运行单个spec文件,可以运行如下命令:要一次运行所有规格,请运行bundle exec rspec。

所以,我在终端中输入gem安装捆绑器,并得到错误:

您没有/Library/Ruby/Gems/2.3.0目录的写权限。

这是在atom的项目文件中

source "https://rubygems.org"
gem "rspec", "~> 3.2.0"

我的问题是:

似乎终端给我的响应,因为我不应该改变ruby上的任何东西,我需要捆绑安装在原子?谁能告诉我如何使用原子或者在原子中运行任何东西?


当前回答

Mac解决方案

安装/更新最新ruby版本的RVM \curl -sSL https://get.rvm.io | bash -s stable 安装打包机 Gem安装捆绑器


这两个命令之后(sudo) gem安装....开始工作

其他回答

我使用Mojave与rbenv,这个解决方案适用于我:

$ vi ~/.bash_profile

将这一行添加到文件中:

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

博士TL;

在一些情况下,我通过关闭终端会话并在重新尝试失败的命令之前打开一个新的会话来解决这类错误。

长解释

在一些SOs(如MacOS)中,已经预先安装了ruby的系统级版本。如果您正在使用版本管理器,例如rbenv或asdf,它们通过处理当前会话的环境来工作,以便相关命令指向版本管理器安装的二进制文件。

When installing a new binary, the version manager installs it in a special location, usually somewhere under the user's home directory. It then configures everything in your PATH so that you get the freshly installed binaries when you issue a command, instead of the ones that came with your system. However, if you don't restart the session (there are other ways of getting your environment updated, but that's the easiest one) you don't get the new configuration and you will be using the original installation.

请小心使用sudo !!!!!!只有当你知道你在做什么!!!!!!!!!!!!

在安装macOS Catalina后,我也遇到了同样的问题。我尝试下命令和它的工作。

sudo gem update

适用于Mac OS 12及以上版本,也适用于Mac OS 13 Xcode 14及以上版本

首先你打电话

出口GEM_HOME = " $ HOME / .gem” 在那之后 Gem安装cocoapods

家它帮助你☺️

运行这个

$ rbenv init
# Load rbenv automatically by appending
# the following to ~/.zshrc:

eval "$(rbenv init -)"

按照说明,(在我的例子中,添加到~/.zshrc);)


同样重要的是:更改只有在重新启动控制台时才生效。两个选项

输入source <modified file> 关上再打开