sous-chefs/nodejs

Problem with npm install from package.json

Closed this issue · 4 comments

I want to provision a VM using vagrant and chef-solo.

I have a package.json file in a folder /var/www.
When I do this in my recipe

nodejs_npm 'main' do
  path '/var/www'
  json true
end

I end up with this error:

==> default:       ================================================================================
==> default:       Error executing action `run` on resource 'execute[install NPM package main]'
==> default:       ================================================================================
==> default:
==> default:       Mixlib::ShellOut::ShellCommandFailed
==> default:       ------------------------------------
==> default:       Expected process to exit with [0], but received ''
==> default:       ---- Begin output of npm install   ----
==> default:       STDOUT:
==> default:       STDERR:
==> default:       ---- End output of npm install   ----

When I add every dependency from my package.json individually to my recipe like this

nodejs_npm 'node-sass' do
  path '/var/www'
end

and so on, everything works fine. Also, when I don't do any npm installing in my recipe at all, and just do it manually afterwards, everything also works fine and I get an exit code 0.

npm: 3.5.2
node: 5.3.0

Any ideas?

+1 Also getting this error. Could it be due to installing a large number of dependencies?

japel commented

This could be a problem related to having too little memory on the vm.
I had a similar problem. After I told vagrant to modify the vm to have 1gb of ram it worked...

config.vm.provider :virtualbox do |v|
  v.customize ["modifyvm", :id, "--memory", 1048]
end

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

When I have enough memory and disk space installing using package.json works. I'm going to recommend the previous solution and close this issue.