我的default.pp
文件中包含以下资源:
class { 'nodejs':
repo_url_suffix => '8.x',
}
-> package {
'gulp':
ensure => 'present',
provider => 'npm';
'webpack':
ensure => 'present',
provider => 'npm';
'pm2':
ensure => 'present',
require => Class['nodejs'],
provider => 'npm';
'@angular/cli':
ensure => 'present',
provider => 'npm';
}
并且在尝试设置Vagrant实例时,它会卡住并且屏幕上没有其他活动:
==> default: Notice: /Stage[main]/Nodejs::Install/Package[nodejs]/ensure: created
==> default: Notice: /Stage[main]/Main/Package[gulp]/ensure: created
==> default: Notice: /Stage[main]/Main/Package[webpack]/ensure: created
==> default: Notice: /Stage[main]/Main/Package[pm2]/ensure: created
我也试过这个:
'pm2':
ensure => 'present',
require => Class['nodejs'],
provider => 'npm';
}
-> exec { 'Install Angular CLI':
command => '/usr/bin/npm install --global @angular/cli',
creates => '/usr/lib/node_modules/@angular/cli/bin/ng'
}
但唯一的区别是这次我得到了超时:
==> default: Error: Command exceeded timeout
==> default: Error: /Stage[main]/Main/Exec[Install Angular CLI]/returns: change from notrun to 0 failed: Command exceeded timeout
超时后,vagrant up
完成任务,我可以使用vagrant ssh
登录并检查它是否已成功安装:
which ng: /usr/bin/ng
所以我怀疑超时是由于@angular/cli
安装的返回状态造成的。
有什么办法可以避免吗?