ruby 代码识别不到环境变量HOME

问题描述

我在用postman模拟请求ruby脚本时,脚本无法识别HOME这个环境变量。

问题出现的环境背景及自己尝试过哪些方法

我的电脑系统是os10.13.6,php.ini已经改了variables_order = "EGPCS",然后也在环境变量中加了HOME=/Users/ergeng,但是ruby脚本还是无法识别。

相关代码

ruby代码:
path = File.expand_path(File.join(Dir.home, ".fastlane"))

你期待的结果是什么?实际看到的错误信息又是什么?

错误信息:
/Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:279:in `home': couldn't find HOME
environment -- expanding `~' (ArgumentError)
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:279:in `fastlane_user_dir'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:290:in `persistent_cookie_path'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:567:in `load_session_from_file'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:412:in `send_shared_login_request'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/portal/portal_client.rb:28:in
`send_login_request'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:771:in `do_login'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:385:in `login'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/client.rb:347:in `login'
from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.129.0/spaceship/lib/spaceship/portal/spaceship.rb:25:in `login'
from ../ruby/ShowCert.rb:31:in `loginPortal'
from ../ruby/ShowCert.rb:46:in `selectTunc'
from ../ruby/ShowCert.rb:54:in `<main>'

阅读 2.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏