Vagrant、Puppet 和 nodejs 模块:在 npm 模块安装时抛出错误 [英] Vagrant, Puppet and nodejs module: throwing error on npm module installation

查看:67
本文介绍了Vagrant、Puppet 和 nodejs 模块:在 npm 模块安装时抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下清单:

include nodejs

package { 'serve':
  ensure => latest,
  provider => 'npm',
}

我正在使用 puppetlab node.js 模块:

I am using the puppetlab node.js module:

http://forge.puppetlabs.com/puppetlabs/nodejs

流浪文件:

Vagrant::Config.run do |config|
  config.vm.box = "precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"

  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = '~/work/environments/default/'
    puppet.manifest_file = 'site.pp'
    puppet.module_path = '~/work/environments/default/modules'
  end

end

当我运行 vagrant up 时,出现以下错误:

When I run vagrant up I am getting the following error:

[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/site.pp...
stdin: is not a tty
err: /Stage[main]//Package[serve]/ensure: change from absent to latest failed: Could not update: Got nil value for ensure at /tmp/vagrant-puppet/manifests/site.pp:6
notice: /Stage[main]/Nodejs/Package[nodejs]/ensure: ensure changed 'purged' to 'present'
notice: /Stage[main]/Nodejs/Package[npm]/ensure: ensure changed 'purged' to 'present'
notice: Finished catalog run in 14.89 seconds

起初我想可能是在安装 npm 之前尝试安装serve"模块,所以我尝试了 require => Package[npm] 但结果相同.

At first I thought maybe it's trying to install the 'serve' module before npm installed so I tried require => Package[npm] but that gave the same result.

那么有人可以解释为什么不安装服务"模块吗?

So could anybody shine some light on why it's not installing the 'serve' module?

推荐答案

似乎是在订购 - 提供程序需要 npm 命令,而您还没有.

It seems to be ordering - the provider needs the npm command, which you don't have yet.

尝试将清单更改为以下内容:

Try altering your manifest to something like:

class { 'nodejs': } -> package { 'serve': ensure => present, provider => 'npm', }

或者,可能:

include nodejs

package { 'serve':
  ensure => present,
  provider => 'npm',
  require => Package['npm'],
}

这篇关于Vagrant、Puppet 和 nodejs 模块:在 npm 模块安装时抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆