sous-chefs/nodejs

Cannot install npm modules

Closed this issue · 5 comments

Hello! I've starting using this cookbook but I'm facing a problem that I wasn't able to overcome.

I'm using a vagrant machine ( box is ubuntu/trusty64 ). Everything works except for npm module installation.

This is the excerpt from mi node.json file ( loaded by chef-solo ):

{
  "run_list": [
    "nodejs::npm", [...]
  ],
  "nodejs": {
    "npm_packages": [
      { "name": "sails" },
      { "name": "grunt-cli" }
    ]
  },
  {...}
}

What am I doing wrong? I want to install sails and grunt-cli module globally.

Thanks for your help

Hi @endorama ,

First node['nodejs']['npm_packages'] is currently only used in nodejs::default recipe.
If you only specify nodejs::npm in your run list, you'll have to call nodejs_npm LWRP by your own.

Then you point a second issue : nodejs::npm is doing nothing if you select embedded install method (which is default behaviour). I'll push an update for this later. We made many changes in nodejs::nodejs recipe, that's why we can still got have kind of mistake.

thanks

second point fixed by #69

For the first issue (packages not installing) you still have to call nodejs_npm LWRP or use default recipe.

Thanks for the clarification!

Could you please confirm that this node.json should work as expected?

{
  "run_list": [
    "nodejs", [...]
  ],
  "nodejs": {
    "npm_packages": [
      { "name": "sails" },
      { "name": "grunt-cli" }
    ]
  },
  {...}
}

Yes, this should be good with this conf

It works! :) Thanks for your help, closing.