下面是我需要做的。

要运行规范,需要安装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上的任何东西,我需要捆绑安装在原子?谁能告诉我如何使用原子或者在原子中运行任何东西?


当前回答

如果您不是默认的Ruby开发人员,那么所有这些答案对您来说都是陌生的。

将所有这些与nodejs中的nvm关联起来

读一下这个简短的信息,然后感谢我 https://daqo.medium.com/using-chruby-as-the-default-ruby-version-manager-c11346e3cc

其他回答

简单的做 Sudo宝石卸载cocoapods为我工作。

我使用参数——user-install运行以下命令:

gem install name_of_gem --user-install

Edit

There was one gem I still could not install (it required the Ruby.h headers of the Ruby development kit or something), then I tried the different version managers, but somehow that still did not really work as it was stated in the documentations how to just install and switch (it did just not switch the versions). Then I removed all the installed version managers and installed afterwards with brew install ruby the latest version and did set the PATH variable, too. (It will be mentioned after the installation of ruby from brew), which worked.

应该使用不同的ruby安装。为此我使用rbenv。

# install your version of ruby
$ rbenv install 2.0.0-p247

# modify .ruby_version on current directory
$ rbenv local 2.0.0-p247

# proceed installing gems
$ gem install bundler

免责声明:我不喜欢红宝石。这对我来说很有效,如果你是一个ruby专家,在这个答案中看到了一些变化,请继续前进或评论!

在用rbenv安装ruby之后,你还需要设置全局ruby。为此,你可以这样做,rbenv全球3.2.1,然后安装绑定器与gem安装绑定器。它会起作用的。

安装rbenv后,我也有这个问题,在我的.bashrc中添加这一行:

$(rbenv init -)

解决了我的问题。