ruby-on-railscapistranowebpacker

rails deployment in development with webpacker failing when precompiling assets


upon launching capistrano deployment, it stops upon precompilation of assets

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).

I've run yarn install --check-files on both local and target server. Locally, all is up-to-date:

yarn install v1.22.5
[1/4] šŸ”  Resolving packages...
success Already up-to-date.
āœØ  Done in 1.99s.

while on the server this is run within the latest release and percolates:

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.

But that release is unusable as any further deployment will be done into a new directory.

And contrary to the suggestion, under the development block of webpacker.yml

check_yarn_integrity: false

does not change this behaviour.

Not sure whether this a rails, webpacker or capistrano issue.

How can this viscious circle be undone?


Solution

  • in config/deploy.rb ensure that command

     append :linked_dirs, `node_modules`  
    

    is included
    then run yarn install --check-filesfrom within the latest repository.