当我想更改网页的内容时,我转到本地项目目录并运行两个命令:
jekyll build
jekyll serve
此后,我的Web应用程序在我的计算机上本地运行。今天,当我尝试运行上述命令时,由于出现以下错误,我被卡在了第一个命令上:
$ jekyll build
Traceback (most recent call last):
5: from /usr/local/bin/jekyll:8:in `<main>'
4: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
3: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
2: from /Users/JaroslavBezdek/.gem/ruby/2.3.0/gems/jekyll-3.8.5/lib/jekyll.rb:34:in `<top (required)>'
1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- safe_yaml/load (LoadError)
我开始在互联网上查找它,发现应该尝试安装缺少的库。但是,它没有解决问题,因为出现了另一个错误:
$ gem install safe_yaml
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
$ sudo gem install safe_yaml
Password:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
我的环境可以描述如下:
$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
$ gem --version
3.1.1
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.1
BuildVersion: 19B88
请,您能帮我解决问题吗?