Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error command webpack not found when I deploy with capistrano

ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
00:00 git:wrapper
  01 mkdir -p /tmp
✔ 01 [email protected] 2.312s
  Uploading /tmp/git-ssh-jec_access-production-jeanlinux.sh 100.0%
  02 chmod 700 /tmp/git-ssh-jec_access-production-jeanlinux.sh
✔ 02 [email protected] 1.210s
00:08 git:check
  01 git ls-remote [email protected]:jeanlinux/jecaccess.git HEAD
  01 02704634ef3fea8fb4ef983aa8a71b184f55f2cd       HEAD
✔ 01 [email protected] 4.701s
00:13 deploy:check:directories
  01 mkdir -p /home/deploy/JecAccess/shared /home/deploy/JecAccess/releases
✔ 01 [email protected] 0.721s
00:13 deploy:check:linked_dirs
  01 mkdir -p /home/deploy/JecAccess/shared/log /home/deploy/JecAccess/shared/tmp/pids /home/deploy/JecAccess/shared/tmp/cache /home/deploy/JecAccess/shared/tmp/sockets /home/deploy/JecAcce…
✔ 01 [email protected] 2.250s
00:16 deploy:check:make_linked_dirs
  01 mkdir -p /home/deploy/JecAccess/shared/config
✔ 01 [email protected] 1.022s
00:22 git:clone
  The repository mirror is at /home/deploy/JecAccess/repo
00:24 git:update
  01 git remote set-url origin [email protected]:jeanlinux/jecaccess.git
✔ 01 [email protected] 1.063s
  02 git remote update --prune
  02 Fetching origin
✔ 02 [email protected] 3.030s
00:30 git:create_release
  01 mkdir -p /home/deploy/JecAccess/releases/20190210065936
✔ 01 [email protected] 0.920s
  02 git archive master | /usr/bin/env tar -x -f - -C /home/deploy/JecAccess/releases/20190210065936
✔ 02 [email protected] 1.636s
00:36 deploy:set_current_revision
  01 echo "02704634ef3fea8fb4ef983aa8a71b184f55f2cd" > REVISION
✔ 01 [email protected] 2.451s
00:38 deploy:symlink:linked_files
  01 mkdir -p /home/deploy/JecAccess/releases/20190210065936/config
✔ 01 [email protected] 1.233s
  02 rm /home/deploy/JecAccess/releases/20190210065936/config/database.yml
✔ 02 [email protected] 2.587s
  03 ln -s /home/deploy/JecAccess/shared/config/database.yml /home/deploy/JecAccess/releases/20190210065936/config/database.yml
✔ 03 [email protected] 0.893s
  04 rm /home/deploy/JecAccess/releases/20190210065936/config/secrets.yml
✔ 04 [email protected] 1.192s
  05 ln -s /home/deploy/JecAccess/shared/config/secrets.yml /home/deploy/JecAccess/releases/20190210065936/config/secrets.yml
✔ 05 [email protected] 4.403s
00:56 deploy:symlink:linked_dirs
  01 mkdir -p /home/deploy/JecAccess/releases/20190210065936 /home/deploy/JecAccess/releases/20190210065936/tmp /home/deploy/JecAccess/releases/20190210065936/public
✔ 01 [email protected] 1.101s
  02 rm -rf /home/deploy/JecAccess/releases/20190210065936/log
✔ 02 [email protected] 0.852s
  03 ln -s /home/deploy/JecAccess/shared/log /home/deploy/JecAccess/releases/20190210065936/log
✔ 03 [email protected] 1.158s
  04 ln -s /home/deploy/JecAccess/shared/tmp/pids /home/deploy/JecAccess/releases/20190210065936/tmp/pids
✔ 04 [email protected] 3.071s
  05 ln -s /home/deploy/JecAccess/shared/tmp/cache /home/deploy/JecAccess/releases/20190210065936/tmp/cache
✔ 05 [email protected] 0.942s
  06 ln -s /home/deploy/JecAccess/shared/tmp/sockets /home/deploy/JecAccess/releases/20190210065936/tmp/sockets
✔ 06 [email protected] 0.727s
  07 ln -s /home/deploy/JecAccess/shared/public/system /home/deploy/JecAccess/releases/20190210065936/public/system
✔ 07 [email protected] 1.159s
  08 ln -s /home/deploy/JecAccess/shared/public/assets /home/deploy/JecAccess/releases/20190210065936/public/assets
✔ 08 [email protected] 1.433s
01:27 bundler:install
  01 /usr/local/rvm/bin/rvm default do bundle install --path /home/deploy/JecAccess/shared/bundle --jobs 4 --without development test --deployment --quiet
✔ 01 [email protected] 2.707s
01:33 deploy:assets:precompile
  01 /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile
  01 Webpacker is installed 🎉 🍰
  01 Using /home/deploy/JecAccess/releases/20190210065936/config/webpacker.yml file for setting up webpack paths
  01 Compiling…
  01 Compilation failed:
  01 yarn run v1.13.0
  01 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  01
  01 warning ../../package.json: No license field
  01 warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
  01 error Command "webpack" not found.
  01

(Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing on host 157.230.93.52: rake exit status: 1 rake stdout: Webpacker is installed 🎉 🍰 Using /home/deploy/JecAccess/releases/20190210065936/config/webpacker.yml file for setting up webpack paths Compiling… Compilation failed: yarn run v1.13.0 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

warning ../../package.json: No license field warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts. error Command "webpack" not found. rake stderr: Nothing written

Caused by: SSHKit::Command::Failed: rake exit status: 1 rake stdout: Webpacker is installed 🎉 🍰 Using /home/deploy/JecAccess/releases/20190210065936/config/webpacker.yml file for setting up webpack paths Compiling… Compilation failed: yarn run v1.13.0 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

warning ../../package.json: No license field warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts. error Command "webpack" not found. rake stderr: Nothing written

Tasks: TOP => deploy:assets:precompile (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing on host 157.230.93.52: rake exit status: 1 rake stdout: Webpacker is installed 🎉 🍰 Using /home/deploy/JecAccess/releases/20190210065936/config/webpacker.yml file for setting up webpack paths Compiling… Compilation failed: yarn run v1.13.0 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

warning ../../package.json: No license field warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts. error Command "webpack" not found. rake stderr: Nothing written

** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines:

DEBUG [5607bacb] Finished in 2.268 seconds with exit status 1 (failed).

INFO [9d26f1fe] Running /usr/local/rvm/bin/rvm default do bundle install --path /home/deploy/JecAccess/shared/bundle --jobs 4 --without development test --deployment --quiet on 157.230.93.52

DEBUG [9d26f1fe] Command: cd /home/deploy/JecAccess/releases/20190210065936 && /usr/local/rvm/bin/rvm default do bundle install --path /home/deploy/JecAccess/shared/bundle --jobs 4 --without development test --deployment --quiet

INFO [2c0ee907] Finished in 2.707 seconds with exit status 0 (successful).

DEBUG [99f77c18] Running if test ! -d /home/deploy/JecAccess/releases/20190210065936; then echo "Directory does not exist '/home/deploy/JecAccess/releases/20190210065936'" 1>&2; false; fi on 157.230.93.52

DEBUG [99f77c18] Command: if test ! -d /home/deploy/JecAccess/releases/20190210065936; then echo "Directory does not exist '/home/deploy/JecAccess/releases/20190210065936'" 1>&2; false; fi

DEBUG [50cd673a] Finished in 2.866 seconds with exit status 0 (successful).

INFO [407a8274] Running /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile on 157.230.93.52

DEBUG [407a8274] Command: cd /home/deploy/JecAccess/releases/20190210065936 && ( export RAILS_ENV="production" RAILS_GROUPS="" ; /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile )

DEBUG [6bf4baca] Webpacker is installed 🎉 🍰

Using /home/deploy/JecAccess/releases/20190210065936/config/webpacker.yml file for setting up webpack paths

DEBUG [6bf4baca] Compiling…

DEBUG [6bf4baca] Compilation failed:

yarn run v1.13.0

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

warning ../../package.json: No license field

warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.

error Command "webpack" not found.

like image 339
Jean Linux Avatar asked Feb 10 '19 07:02

Jean Linux


1 Answers

You need to add this to the bottom of config/deploy.rb:

before "deploy:assets:precompile", "deploy:yarn_install"
namespace :deploy do
  desc "Run rake yarn install"
  task :yarn_install do
    on roles(:web) do
      within release_path do
        execute("cd #{release_path} && yarn install --silent --no-progress --no-audit --no-optional")
      end
    end
  end
end

Got this code from https://github.com/rails/webpacker/blob/master/docs/deployment.md

like image 189
Andrew Koster Avatar answered Oct 03 '22 06:10

Andrew Koster