如果您的发布文件夹中有非发布目录,则npm install命令将失败,如下所示,
* executing `node:install_packages'
* executing "ls -x /home/ubuntu/support/releases"
servers: ["spp"]
[spp] executing command
command finished in 296ms
* executing "mkdir -p /home/ubuntu/support/releases/surveys.csv/node_modules ; cp -r /home/ubuntu/support/releases/surveys.csv/node_modules /home/ubuntu/support/releases/20150203163509"
servers: ["spp"]
[spp] executing command
** [out :: spp] mkdir:
** [out :: spp] cannot create directory `/home/ubuntu/support/releases/surveys.csv'
** [out :: spp] : Not a directory
** [out :: spp]
** [out :: spp] cp:
** [out :: spp] cannot stat `/home/ubuntu/support/releases/surveys.csv/node_modules'
** [out :: spp] : Not a directory
** [out :: spp]
command finished in 307ms
*** [deploy:update_code] rolling back
这里是发布目录的样子......
> ls -lt
total 66324
drwxrwsr-x 13 ubuntu ubuntu 4096 Feb 3 05:58 20150109231012
-rw-rw-r-- 1 ubuntu ubuntu 672733 Feb 1 10:01 surveys.csv
drwxrwsr-x 13 ubuntu ubuntu 4096 Dec 10 19:15 20141210191517
项目认为这是一项功能,但在部署新版本时,我宁愿不尝试共享/复制旧的node_modules目录。
有没有办法将其关闭?
答案 0 :(得分:0)
失败是因为surveys.csv
文件比previous_release
目录更新,如果再次部署它应该会有效。
您可以覆盖node:install_packages
任务:
Rake::Task["node:install_packages"].clear_actions
namespace :node do
task :install_packages do
run "cd #{release_path} && npm install --loglevel warn"
end
end