无法加载此类文件 - mygem1

时间:2018-01-02 06:39:23

标签: chef chef-recipe

当我尝试使用chef-client运行食谱时,我创建了mygem:

 chef-client -zr recipe[Migration::2]

抛出错误:

 LoadError
    ---------
    cannot load such file -- mygem

    Running handlers:
    [2018-01-02T11:57:40+05:30] ERROR: Running exception handlers
    Running handlers complete
    [2018-01-02T11:57:40+05:30] ERROR: Exception handlers complete
    Chef Client failed. 0 resources updated in 15 seconds
    [2018-01-02T11:57:40+05:30] FATAL: Stacktrace dumped to c:/workstation-repo/.che
    f/local-mode-cache/cache/chef-stacktrace.out
    [2018-01-02T11:57:40+05:30] FATAL: Please provide the contents of the stacktrace
    .out file if you file a bug report
    [2018-01-02T11:57:40+05:30] FATAL: LoadError: cannot load such file -- mygem1

1 个答案:

答案 0 :(得分:0)

Chef在运行时使用自己的Ruby环境,与系统Ruby环境分开。可以通过chef_gem资源安装Gems。不建议新用户使用,因为编写脆弱的代码非常容易。如果您的目标是运行数据库迁移或类似操作,则可能需要运行命令execute的{​​{1}}资源。