When you run
puppet resource package on an agent that is in a non-production environment, you get a
Could not find a directory environment error.
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/environments.rb:38 :in `get!': Could not find a directory environment named 'development' anywhere in the path: C:/ProgramData/PuppetLabs/code/environments. Does the directory exist (Puppet::Environments::EnvironmentNotFound)
puppet resource command is intended to be run on the primary server node, which is also the location for non-production environment configuration. There’s no environment configuration information on the agent, so you get an error.
Version and installation information
PE version: All supported versions
puppet resource is intended to be run only on the primary server, you can run it on an agent node. If the agent is in the production environment, run
puppet resource package. If it is in any other environment, pass the production environment to the command:
puppet resource package --environment=production