Still using bundled npm even though installing other version
Closed this issue · 4 comments
sommestad commented
We're using the cookbook to install a specific Node version and a specific NPM version. However, it seems like the defined NPM version isn't used. Instead it uses the npm version bundled in the node package (which is 1.4.x
).
In our recipe:
node.override['nodejs']['engine'] = 'node'
node.override['nodejs']['version'] = '0.10.38'
node.override['nodejs']['npm']['version'] = '2.7.6'
include_recipe 'nodejs::nodejs_from_binary'
include_recipe 'nodejs::npm_from_source'
After this, the symlink points to:
ubuntu:~$ ls -la /usr/local/bin/npm
lrwxrwxrwx 1 root root 40 Jun 22 15:55 /usr/local/bin/npm -> /usr/local/nodejs-binary-0.10.38/bin/npm
Which is an older version:
ubuntu:~$ npm -version
1.4.28
Is this expected behavior, or a potential bug?
Our current workaround is to "manually" replace the symlink afterwards, but that feels kind of ugly. 😒
Node.js Cookbook: 2.4.0
OS: Ubuntu 14.04
Chef: 11.14
Paul2e commented
👍 I also have this issue. Changing the symlink works only until the next provision at which time it updates reverts back to the embedded version.
guilhem commented
@sommestad can you gist a log of your first run?
rmoriz commented
chef_gem 'chef-rewind'
require 'chef/rewind'
include_recipe 'nodejs::nodejs_from_binary'
include_recipe 'nodejs::npm_from_source'
### HACK
### fix for https://github.com/redguide/nodejs/issues/90
if node['nodejs']['install_method'] == 'binary'
rewind 'ark[nodejs-binary]' do
has_binaries ['bin/node']
end
end