node.js - how do you run "npm install" inside of a folder from chef? -
i attempting install nodejs project git via chef script. banging head trying npm install run inside of installed projects directory , leveraging included "package.json" coming git.
i tried dwith deprecated npm cookbook:
18>> npm_package 19: path node[:deploy_nodejs_from_git][:destination] 20: action :install_from_json 21: end
but isn't working - , don't know if worth effort make work since deprecated:
[2015-05-15t08:50:25-04:00] error: must supply name when declaring npm_package resource
i have looked @ nodejs cookbook - requires list out packages , not defer package.json.
is not right approach? small shop , being able leverage package.json , not have replicate seems ideal.
this using, pending identification of better altternative:
if node[:deploy_nodejs_from_git][:destination] path = node[:deploy_nodejs_from_git][:destination] cmd = "npm install" execute "npm install @ #{path}" cwd path command cmd end end
the entire recipe install nodejs project git repo (with self signed ssl), , subsequently calling npm install leveraging underlying package.json:
env['git_ssl_no_verify']="true" directory node[:deploy_nodejs_from_git][:destination] owner 'root' group 'root' mode '0755' action :create end git node[:deploy_nodejs_from_git][:destination] repository node[:deploy_nodejs_from_git][:git_repo] action :sync revision node[:deploy_nodejs_from_git][:branch] end if node[:deploy_nodejs_from_git][:destination] path = node[:deploy_nodejs_from_git][:destination] cmd = "npm install" execute "npm install @ #{path}" cwd path command cmd end end
Comments
Post a Comment