Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails &引用;gem安装导轨“;只安装文档,不安装rails_Ruby On Rails - Fatal编程技术网

Ruby on rails &引用;gem安装导轨“;只安装文档,不安装rails

Ruby on rails &引用;gem安装导轨“;只安装文档,不安装rails,ruby-on-rails,Ruby On Rails,我无法创建rails应用程序,因为未执行rails命令 当我运行rails-v时 Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails You can then rerun your "rails" command. 当我在/usr/local/lib/ruby/gems/3.0.0/gem

我无法创建rails应用程序,因为未执行
rails
命令

当我运行
rails-v时

Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.
当我在
/usr/local/lib/ruby/gems/3.0.0/gems/rails-6.1.3.2
打开rails gem安装时,我看到的唯一文件是
README.md

我想也应该安装其他文件

如果我在命令行中运行
sudogem install rails-V
,它会说

HEAD https://index.rubygems.org/
200 OK
GET https://index.rubygems.org/info/rails
200 OK
GET https://index.rubygems.org/info/actioncable
200 OK
GET https://index.rubygems.org/info/actionmailbox
200 OK
GET https://index.rubygems.org/info/actionmailer
200 OK
GET https://index.rubygems.org/info/actionpack
200 OK
GET https://index.rubygems.org/info/actiontext
200 OK
GET https://index.rubygems.org/info/actionview
200 OK
GET https://index.rubygems.org/info/actionwebservice
200 OK
GET https://index.rubygems.org/info/activejob
200 OK
GET https://index.rubygems.org/info/activemodel
200 OK
GET https://index.rubygems.org/info/activerecord
200 OK
GET https://index.rubygems.org/info/activeresource
200 OK
GET https://index.rubygems.org/info/activestorage
200 OK
GET https://index.rubygems.org/info/activesupport
200 OK
GET https://index.rubygems.org/info/bundler
200 OK
GET https://index.rubygems.org/info/railties
200 OK
GET https://index.rubygems.org/info/rake
200 OK
GET https://index.rubygems.org/info/sprockets-rails
200 OK
GET https://index.rubygems.org/info/rack
200 OK
GET https://index.rubygems.org/info/rack-test
200 OK
GET https://index.rubygems.org/info/rails-dom-testing
200 OK
GET https://index.rubygems.org/info/rails-html-sanitizer
200 OK
GET https://index.rubygems.org/info/mail
200 OK
GET https://index.rubygems.org/info/concurrent-ruby
200 OK
GET https://index.rubygems.org/info/i18n
200 OK
GET https://index.rubygems.org/info/minitest
200 OK
GET https://index.rubygems.org/info/tzinfo
200 OK
GET https://index.rubygems.org/info/zeitwerk
200 OK
GET https://index.rubygems.org/info/method_source
200 OK
GET https://index.rubygems.org/info/thor
200 OK
GET https://index.rubygems.org/info/builder
200 OK
GET https://index.rubygems.org/info/erubi
200 OK
GET https://index.rubygems.org/info/globalid
200 OK
GET https://index.rubygems.org/info/mime-types
200 OK
GET https://index.rubygems.org/info/mini_mime
200 OK
GET https://index.rubygems.org/info/treetop
200 OK
GET https://index.rubygems.org/info/nio4r
200 OK
GET https://index.rubygems.org/info/websocket-driver
200 OK
GET https://index.rubygems.org/info/websocket-extensions
200 OK
GET https://index.rubygems.org/info/marcel
200 OK
GET https://index.rubygems.org/info/nokogiri
200 OK
GET https://index.rubygems.org/info/mini_portile2
200 OK
GET https://index.rubygems.org/info/racc
200 OK
GET https://index.rubygems.org/info/json
200 OK
GET https://index.rubygems.org/info/loofah
200 OK
GET https://index.rubygems.org/info/mini_portile
200 OK
GET https://index.rubygems.org/info/pkg-config
200 OK
GET https://index.rubygems.org/info/thread_safe
200 OK
GET https://index.rubygems.org/info/crass
200 OK
GET https://index.rubygems.org/info/sprockets
200 OK
/usr/local/lib/ruby/gems/3.0.0/gems/rails-6.1.3.2/README.md
Successfully installed rails-6.1.3.2
Parsing documentation for rails-6.1.3.2
Parsing sources...
100% [ 1/ 1]  README.md
Done installing documentation for rails after 0 seconds
1 gem installed
安装的唯一文件是自述文件

我应该运行不同的安装命令吗


我还看到安装了
railties
,其中包含
/railties-6.1.3.2/exe/rails
,这似乎是运行
rails
时应该调用的文件。也许我需要将其添加到系统路径中?我正在使用Mac OS。

听起来您已经安装了具有sudo权限的Ruby on Rails。 您需要使用rbenv或rvm来确保权限正确。所以你不必使用sudo

你应该能跑 宝石安装

靠自己

我将尝试使用本指南重新开始安装您的开发环境

也许在mac上创建一个新的管理员用户帐户只是为了rails的开发


否则,您将不得不查找其未获得正确文件夹权限的原因。

通过将rails添加到系统路径来修复。

首先确保您已从哪个源安装了ruby和ruby gems,如rvm、rbenv等,并确保您有权访问在安装ruby和gems时创建的这些文件夹。如果没有,请将路径添加到~/.bashrc文件,然后您可以访问路径中安装的gems

运行以下命令将路径粘贴到源文件

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile