sous-chefs/nodejs

npm is not available when using package install with Ubuntu 16.04

teknofire opened this issue · 4 comments

With Ubuntu 16.04 it looks like npm is no longer installed with the nodejs package. I had to add npm and nodejs-legacy to the package list with something the following code before I could converge

if node['platform_family'] == 'debian'
  if node['platform_version'].to_i == 16
    default['nodejs']['packages'] = ['nodejs', 'nodejs-legacy', 'npm']
  end
end

metadata.rb

depends 'pm2'
depends 'nodejs'
depends 'build-essential'

receipe/default.rb

  include_recipe 'nodejs'
  nodejs_npm 'pm2' do
    version node['pm2']['pm2_version'] if node['pm2'].attribute?('pm2_version')
  end

use node_6.x repo works for me on 16.04

node.override['nodejs']['repo'] = 'https://deb.nodesource.com/node_6.x'
include_recipe 'nodejs'

@matt-wormley followed your work around and everything seems good :) Thanks!

Yup, that also works for me. It looks like it was trying to install a really old version of nodejs with the default nodejs repo.

tas50 commented

#164 fixes this by using the newer repo