rails 在预编译资产时使用 webpacker 进行开发部署失败

rails deployment in development with webpacker failing when precompiling assets

启动 Capistrano 部署后,它会在资产预编译时停止

INFO [7e60e5e4] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as deploy@...243
 DEBUG [7e60e5e4] Command: cd /home/deploy/zappa/releases/20210110095959 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.6.1" RAILS_ENV="development" RAILS_GROUPS="" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
 DEBUG [7e60e5e4]   error Couldn't find an integrity file
 DEBUG [7e60e5e4]   error Found 1 errors.
 DEBUG [7e60e5e4]   

========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================


To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).

我在本地和目标服务器上都 运行 yarn install --check-files。在本地,所有都是最新的:

yarn install v1.22.5
[1/4]   Resolving packages...
success Already up-to-date.
✨  Done in 1.99s.

在服务器上这是 运行 在最新版本中并渗透:

yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
Done in 11.35s.

但是该版本无法使用,因为任何进一步的部署都将在新目录中完成。

与建议相反,在webpacker.yml

的开发块下
check_yarn_integrity: false

不会改变此行为。

不确定这是 rails、webpacker 还是 capistrano 问题。

这个恶性循环如何才能消除?

config/deploy.rb中确保命令

 append :linked_dirs, `node_modules`  

已收录
然后 运行 yarn install --check-files来自最新的存储库。