相关疑难解决方法(0)

Ruby 1.9如果我有一个shebang指向ruby,为什么系统不能看到它?

我正在使用Ubuntu.我正在尝试运行ruby文件todo.rb我添加了这个shebang作为文件的第一行

#!/usr/bin/env ruby
Run Code Online (Sandbox Code Playgroud)

我转到rb文件所在的目录,然后运行todo.rb并获取错误todo.rb: command not found.

所以我直接进入了/ usr/bin目录.我找到了env命令并运行它.该env命令的输出显示ruby路径和ruby数据:

MY_RUBY_HOME=/home/tallercreativo/.rvm/rubies/ruby-1.9.2-p290
PATH=/home/tallercreativo/.rvm/gems/ruby-1.9.2-p290/bin:/home/tallercreativo/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/tallercreativo/.rvm/rubies/ruby-1.9.2-p290/bin:/home/tallercreativo/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
GEM_PATH=/home/tallercreativo/.rvm/gems/ruby-1.9.2-p290:/home/tallercreativo/.rvm/gems/ruby-1.9.2-p290@global
RUBY_VERSION=ruby-1.9.2-p290
Run Code Online (Sandbox Code Playgroud)

因此,我无法使其工作,我改变了shebang直接指向ruby:

#!/home/tallercreativo/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
Run Code Online (Sandbox Code Playgroud)

我得到相同的命令没有找到错误.怎么了?

ruby

4
推荐指数
2
解决办法
4298
查看次数

需要'nokogiri'时找不到"require"命令

安装了Homebrew,ruby 2.0.0p648,nokogiri 1.6.7.2.当需要'nokogiri'时出现错误:

-bash: require: command not found
Run Code Online (Sandbox Code Playgroud)

怎么了?

ruby bash command-line nokogiri

-4
推荐指数
1
解决办法
2178
查看次数

标签 统计

ruby ×2

bash ×1

command-line ×1

nokogiri ×1