sous-chefs/nodejs

nodejs::nodejs_from_binary and nodejs_npm interaction unexpected and undesirable behavior

Closed this issue · 2 comments

Hi, I encountered a strange side effect when using the nodejs::nodejs_from_binary recipe and then later using the nodejs_npm LWRP. After first invocation and completion of nodejs_npm, the nodejs::nodejs_from_package recipe gets called implicitly.

Here is a gist of what happens during my converge:
https://gist.github.com/smeinel/df8c0cdfe2373d532514

TL;DR version:

  • nodejs::nodejs_from_binary recipe is performed (lines 4-57)
  • nodejs_npm "uglify-js" is called (lines 77-85)
  • nodejs::nodejs_from_package recipe is performed (lines 88-101)
  • nodejs_npm "browserify" is called (lines 102-111)

If I set node['nodejs']['install_method'] = 'binary' then the nodejs::nodejs_from_package recipe invocation does not occur. This interaction is unexpected, and lead to a series of confusing bugs related to the expected state of the server's environment.

Part of this could perhaps be fixed by a documentation change warning people to explicitly set their install_method. However, the action of implicitly installing a different version of node and npm after performing a nodejs_npm call certainly should be considered a bug.

Hi @smeinel ,

This is fixed by #70

tested with :
attributes (binary is in comment):

#default['nodejs']['install_method'] = 'binary' 
default['nodejs']['version'] = '0.12.2'
default['nodejs']['binary']['checksum']['linux_x64'] = '4e1578efc2a2cc67651413a05ccc4c5d43f6b4329c599901c556f24d93cd0508'

recipe :

include_recipe 'nodejs::nodejs_from_binary'
nodejs_npm 'uglify-js'

All is OK now :)

That's great news! I'll try 2.4.0 next week and give it a try! Thanks!