Getting error - cannot load such file -- chef/rest (LoadError)

Hi, I’m trying to set up chef (and especially knife) for a local development on my local machine. I use rbenv + bundler to manage ruby and packages. Server is in 14.13.11 so I have installed chef gem with that particular version too. I have a working .chef/ setup as when I use it on another machine, everything works fine. However, when I use it on my local machine, I get:

/Users/me/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- chef/rest (LoadError)```
even when I use `knife help` . Any ideas? I'm asking here before I create a ticket.

I know about

but it looks like some internal component of chef uses these

“Server is in 14.13.11 so I have installed chef gem with that particular version too” is the wrong logic

That’s a relatively current server so you should be on chef-17.x probably

And you should consider using the omnibus-chef install

If you go with bundler + rbenv you’re a bit on your own

I started off by installing the newest chef gem but got this error so I downgraded to align with the server version, so same stuff on the newest

Chef-14.x would have never supported ruby 2.7 though, that would be chef-16+

The server and client versions aren’t at all aligned

Even though it says “chef/rest” that error has nothing to do with the server

Understood about the versioning. Yeah, I figured this is a client package error

Ir you’re trying to do it on your own you’re going to have to figure out the ruby versions that chef-client supports. in the april following the ruby version release we update the client os that it runs on it. so chef-client 17 for ruby 3.0 is current. chef-client 16 was current when ruby 2.7 was released

Chef-17 is actually busted on ruby 2.7 due to bugs as well

Btw. doesn’t chef gem state which ruby version it supports? shouldn’t it bark when I try to install a wrong gem version for a wrong ruby version?

Ok, I’ve done:
gem install --default -v16.13.16 chef
now it’s:

$ knife
Traceback (most recent call last):
	4: from /Users/me/.rbenv/versions/2.7.2/bin/knife:23:in `<main>'
	3: from /Users/me/.rbenv/versions/2.7.2/bin/knife:23:in `load'
	2: from /Users/me/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/chef-16.13.16/bin/knife:22:in `<top (required)>'
	1: from /Users/me/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/me/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- chef/application/knife (LoadError)```

What’s the supported installation mode then? Isn’t rbenv + bundler a standard?

curl -L <> | sudo bash -s -- -P chef -v 17

Or install the mixlib-install gem: mixlib-install download chef -v 17


Although for workstation use you should really use chef-workstation instead of chef