【发布时间】:2017-10-27 09:19:30
【问题描述】:
我正在尝试部署 Rails 5.1 应用程序。我已经多次部署该应用程序没有问题,但现在,我突然从 Capistrano 收到此错误消息
00:13 deploy:cleanup
SSHKit::Command::Failed: rm exit status: 1
rm stdout: Nothing written
rm stderr: rm: cannot remove '/opt/www/absence-
registrator/releases/20171017091250/node_modules/jquery/dist/jquery.js':
Permission denied
Tasks: TOP => deploy:cleanup
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as
user@myapp.com: rm exit status: 1 │
rm stdout: Nothing written
rm stderr: rm: cannot remove '/opt/www/absence-
registrator/releases/20171017091250/node_modules/jquery/dist/jquery.js':Permission denied
rm: cannot remove '/opt/www/absence-registrator/releases/20171017091250/node_modules/jquery/dist/jquery.slim.js': Permission denied rm: cannot remove '/opt/www/absence-registrator/releases/20171017091250/node_modules/jquery/dist/jquery.min.js': Permission denied rm: cannot remove '/opt/www/absence-registrator/releases/20171017091250/node_modules/jquery/dist/jquery.min.map': Permission denied
Capistrano 用于删除旧版本的部署用户似乎没有足够的权限来删除 node_modules
我尝试通过将 node_modules 设置为链接目录来解决此问题:
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets node_modules}
但这也没有解决问题。
有人知道如何解决这个问题吗?
感谢您的帮助,
安东尼
ps:这是当前目录下 ls -lt 命令的输出:
-rw-rw-r-- 1 deploy deploy 864 Oct 27 14:04 Capfile
-rw-rw-r-- 1 deploy deploy 2454 Oct 27 14:04 Gemfile
-rw-rw-r-- 1 deploy deploy 8520 Oct 27 14:04 Gemfile.lock
-rw-rw-r-- 1 deploy deploy 148 Oct 27 14:04 README.md
-rw-rw-r-- 1 deploy deploy 227 Oct 27 14:04 Rakefile
drwxrwxr-x 10 deploy deploy 4096 Oct 27 14:04 app
drwxrwxr-x 2 deploy deploy 4096 Oct 27 14:04 bin
drwxrwxr-x 6 deploy deploy 4096 Oct 27 14:04 config
-rw-rw-r-- 1 deploy deploy 130 Oct 27 14:04 config.ru
drwxrwxr-x 3 deploy deploy 4096 Oct 27 14:04 db
drwxrwxr-x 4 deploy deploy 4096 Oct 27 14:04 lib
-rw-rw-r-- 1 deploy deploy 103 Oct 27 14:04 package.json
drwxrwxr-x 8 deploy deploy 4096 Oct 27 14:04 spec
drwxrwxr-x 2 deploy deploy 4096 Oct 27 14:04 vendor
-rw-rw-r-- 1 deploy deploy 228 Oct 27 14:04 yarn.lock
drwxrwxr-x 2 deploy deploy 4096 Oct 27 13:58 assets_manifest_backup
drwxrwxr-x 3 deploy deploy 4096 Oct 27 13:58 public
lrwxrwxrwx 1 deploy deploy 48 Oct 27 13:58 node_modules ->
/opt/www/absence-registrator/shared/node_modules
drwxrwxr-x 2 deploy deploy 4096 Oct 27 13:58 tmp
lrwxrwxrwx 1 deploy deploy 39 Oct 27 13:58 log -> /opt/www/absence-
registrator/shared/log
-rw-rw-r-- 1 deploy deploy 41 Oct 27 13:58 REVISION
【问题讨论】:
-
也许改变用户和组,例如
chown -R deploy:deploy /opt/www/absence-registrator/shared/log