]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/nodejs/providers/package.rb
Cope with a clean NPM install that has no packages yet
[chef.git] / 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)