]> git.openstreetmap.org Git - chef.git/commitdiff
Cope with a clean NPM install that has no packages yet
authorTom Hughes <tom@compton.nu>
Tue, 4 Jun 2013 12:23:49 +0000 (13:23 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 4 Jun 2013 12:25:05 +0000 (13:25 +0100)
cookbooks/nodejs/providers/package.rb

index f726df310734abae51fee954610d0feb238cead4..ec20d157d023b9aa382aa1dee6aeb065e87b8471 100644 (file)
@@ -23,7 +23,7 @@ require "json"
 include Chef::Mixin::ShellOut
 
 def load_current_resource
-  @packages = JSON.parse(shell_out("npm list --global --json").stdout)["dependencies"]
+  @packages = JSON.parse(shell_out("npm list --global --json").stdout)["dependencies"] || {}
 
   @current_resource = Chef::Resource::NodejsPackage.new(new_resource.name)
   @current_resource.package_name(new_resource.package_name)