Open
Description
π£οΈ Foreword
This is related to #245 , but adding bug Issue for visibility for others who might encounter it.
π» Brief Description
With a recent version of NPM and it's push for deprecating -global
, unfortunately it can cause problems when installing packages, because the warning still spits out, thus causing problems with expected JSON, this manifests in a client run with:
* execute[install NPM package appcenter-cli] action run[2022-06-08T01:41:48-05:00] ERROR: nodejs::library::nodejs_helper::npm_list exception 785: unexpected token at ''
================================================================================
Error executing action `run` on resource 'execute[install NPM package appcenter-cli]'
================================================================================
NoMethodError
-------------
undefined method `[]' for false:FalseClass
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:53:in `npm_package_installed?'
/var/chef/cache/cookbooks/nodejs/resources/npm_package.rb:84:in `package_installed?'
/var/chef/cache/cookbooks/nodejs/resources/npm_package.rb:54:in `block (3 levels) in class_from_file'
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/nodejs/resources/npm_package.rb
47: execute "install NPM package #{new_resource.package}" do
48: cwd new_resource.path
49: command "npm install #{npm_options}"
50: user new_resource.user
51: group new_resource.group
52: environment npm_env_vars
53: live_stream new_resource.live_stream
54: not_if { package_installed? && no_auto_update? }
55: end
56: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/nodejs/resources/npm_package.rb:47:in `block in class_from_file'
execute("install NPM package appcenter-cli") do
action [:run]
default_guard_interpreter :execute
command "npm install -global appcenter-cli@2.10.10"
backup 5
environment {"HOME"=>"/var/root", "USER"=>"root"}
returns 0
user "root"
declared_type :execute
cookbook_name "nodejs"
domain nil
not_if { #code block }
end
There's a couple red-herrings in there, but believe I've tracked it down to https://github.com/sous-chefs/nodejs/blob/main/libraries/nodejs_helper.rb#L25
π₯ Cookbook version
Likely 7.3.0 and up
π©βπ³ Chef-Infra Version
N/A
π© Platform details
Definitely impacts macOS
Steps To Reproduce
Have NPM 8.11 installed (supposedly that's the affected version)
π Expected behavior
Successful install
β Additional context
NPM : npm/cli#4980
There was a revert back to 8.12.1, but damage may already be done.
Metadata
Metadata
Assignees
Labels
No labels