gpt4 book ai didi

Windows bundle 安装 : HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory (RuntimeError)

转载 作者:可可西里 更新时间:2023-11-01 13:50:41 26 4
gpt4 key购买 nike

我成功安装了bundler

gem install bundler

然后我尝试做

bundle install

我收到以下错误:

C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rbreadline.rb:1097:in `<module:RbReadline>': HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory (RuntimeError)
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rbreadline.rb:17:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/readline.rb:10:in `<module:Readline>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/readline.rb:8:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/line_editor.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:8:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendored_thor.rb:3:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/exe/bundle:18:in `<top (required)>'
from C:/Ruby22-x64/bin/bundle:22:in `load'
from C:/Ruby22-x64/bin/bundle:22:in `<main>'

似乎是环境变量的错误,但是在我的系统中设置正确

set HOME
HOMEDRIVE=C:
HOMEPATH=\Users\My Näme

是的,我的名字中有斯堪的纳维亚字母,所以我想知道这是否是问题所在。我想我以前用 web2py 安装程序遇到过一次。

无论如何,有什么想法可以解决这个问题吗?

最佳答案

如果您在域 PC 上并且您的 PC 设置为事件目录的一部分,则可能会遇到此问题。在这种情况下,您的 HOMEPATHHOMEDRIVEHOME 环境变量是在您的企业事件目录或域中设置的。一旦离开域组或与公司网络断开连接,您就会失去对这些变量的访问权限,因此会出现错误。在 windows 中使用 setx 永久环境变量来覆盖企业环境变量并重新启动系统以使其生效。

SETX HOMEDRIVE %SYSTEMDRIVE% -m
SETX HOMEPATH \Users\%username% -m
SET HOME=%SYSTEMDRIVE%\Users\%USERNAME%
SETX HOME "%HOME%"
SET TEMP=%HOME%\Local Settings\Temp
SETX TEMP "%TEMP%"
SETX TMP "%TEMP%"

这已经在 Windows 10 上测试过并且有效。将其复制并粘贴到脚本中并放入启动文件夹中,或者将其逐行粘贴到 CMDPowerShell 中。或者使用 Task Scheduler 设置为任务。注意 当使用 setx 时,将带有空格的字符串用双引号括起来。

关于Windows bundle 安装 : HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory (RuntimeError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39179377/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com