运行Amazon Linux 2的Amazon EC2实例已安装Jekyll,并正在尝试为其代码遵循this github example结构的应用程序提供服务,如您所见,该结构使用gemspec file管理依赖项。
问题在于,运行bundle exec jekyll serve
开始为应用提供服务时,抛出错误,指示找不到nokogiri。
我已经在许多诊断序列集合中多次运行以下两个命令,但是bundle仍然无法找到nokogiri
:
gem install nokogiri -v '1.10.9' --source 'https://rubygems.org/'
gem pristine nokogiri --version 1.10.9
我也多次使用terraform
从头开始重新安装EC2实例。
需要运行哪些特定命令才能使
bundle
正确使用nokogiri
而不会出错?
以下是指示问题的命令和输出序列:
[admin@server.ip jekyll-files]$ bundle info nokogiri
Could not find nokogiri-1.10.9 in any of the sources
[admin@server.ip jekyll-files]$ bundle exec jekyll serve
Could not find nokogiri-1.10.9 in any of the sources
Run `bundle install` to install missing gems.
[admin@server.ip jekyll-files]$ gem pristine nokogiri --version 1.10.9
Restoring gems to pristine condition...
Building native extensions. This could take a while...
Restored nokogiri-1.10.9
[admin@server.ip jekyll-files]$ bundle install
Ignoring nokogiri-1.10.9 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.9
Fetching gem metadata from https://rubygems.org/.........
Using public_suffix 4.0.3
Following files may not be writable, so sudo is needed:
/usr/bin
Using addressable 2.7.0
Using ast 2.4.0
...(redacting unrelated excess output for stack overflow)
Fetching nokogiri 1.10.9
Installing nokogiri 1.10.9 with native extensions
...(redacting unrelated excess output for stack overflow)
Bundle complete! 8 Gemfile dependencies, 46 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
[admin@server.ip jekyll-files]$ bundle exec jekyll serve
Could not find nokogiri-1.10.9 in any of the sources
Run `bundle install` to install missing gems.
[admin@server.ip jekyll-files]$
要解决上述与sudo
相关的警告,我无法在sudo
命令前运行bundle
,也无法更改{ {1}}是非root用户,但是我在诊断过程中确实多次运行了以下命令,但上面显示的错误没有变化:
/usr/bin