我正在使用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)
我得到相同的命令没有找到错误.怎么了?
安装了Homebrew,ruby 2.0.0p648,nokogiri 1.6.7.2.当需要'nokogiri'时出现错误:
-bash: require: command not found
Run Code Online (Sandbox Code Playgroud)
怎么了?