sous-chefs/nodejs

How to do `npm install` with package.json present

Closed this issue · 3 comments

How to do `npm install` with package.json present

hi @mmahalwy ,

You can just use path LWRP attribute. It changes pwd of the npm install command.
https://github.com/redguide/nodejs/blob/master/resources/npm.rb#L27

It is true that the readme is not very precise on this point.

So if the file is
/app/package.json what would I do?

nodejs_npm 'app' do
  path '/app/'
  json true
end

@mmahalwy , if json is set to true, it will look for a package.json in directory you set as path. This will install the dependencies into /app/node_modules/...