问题描述
我正在尝试部署使用 create-react-app 创建的 React 应用程序,并使用 Capistrano 进行部署,并将 AWS 中的 Ubuntu 服务器用作服务器。
版本 - 卡皮斯特拉诺:3.15 反应:17.0.1
在部署到 AWS ec2 ubuntu 实例服务器时出现以下错误,
.
.
.
00:29 npm:install
01 /tmp/shopping/nvm-exec.sh npm install --silent --no-progress
01 Now using node v15.5.1 (npm v6.14.11)
01
01 audited 2210 packages in 48.746s
01
01
01 3 packages are looking for funding
01
01 run `npm fund` for details
01
01
01 found 0 vulnerabilities
01
01
✔ 01 ubuntu@IP_ADDR 51.633s
01:21 deploy:npm_deploy
01 build
01 /usr/bin/env:
01 ‘build’
01 : No such file or directory
01
stdout: /usr/bin/env: ‘build’: No such file or directory
stderr: Nothing written
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as ubuntu@IP_ADDR: exit status: 127
stdout: /usr/bin/env: ‘build’: No such file or directory
stderr: Nothing written
Caused by:
SSHKit::Command::Failed: exit status: 127
stdout: /usr/bin/env: ‘build’: No such file or directory
stderr: Nothing written
Tasks: TOP => deploy:symlink:release => deploy:npm_deploy
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as ubuntu@IP_ADDR: exit status: 127
stdout: /usr/bin/env: ‘build’: No such file or directory
stderr: Nothing written
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
DEBUG [6caec9a2]
DEBUG [6caec9a2]
DEBUG [6caec9a2] 3 packages are looking for funding
DEBUG [6caec9a2]
DEBUG [6caec9a2] run `npm fund` for details
DEBUG [6caec9a2]
DEBUG [6caec9a2]
DEBUG [6caec9a2] found 0 vulnerabilities
DEBUG [6caec9a2]
DEBUG [6caec9a2]
INFO [6caec9a2] Finished in 51.633 seconds with exit status 0 (successful).
DEBUG [141e7887] Running if test ! -d ~/projects/shopping/staging/releases/20210125100109; then echo "Directory does not exist '~/projects/shopping/staging/releases/20210125100109'" 1>&2; false; fi as ubuntu@IP_ADDR
DEBUG [141e7887] Command: if test ! -d ~/projects/shopping/staging/releases/20210125100109; then echo "Directory does not exist '~/projects/shopping/staging/releases/20210125100109'" 1>&2; false; fi
DEBUG [141e7887] Finished in 0.602 seconds with exit status 0 (successful).
INFO [7e4d0fd0] Running /usr/bin/env build as ubuntu@IP_ADDR
DEBUG [7e4d0fd0] Command: cd ~/projects/shopping/staging/releases/20210125100109 && ( export NODE_VERSION="v15.5.1" ; /usr/bin/env build )
DEBUG [7e4d0fd0] /usr/bin/env:
DEBUG [7e4d0fd0] ‘build’
DEBUG [7e4d0fd0] : No such file or directory
DEBUG [7e4d0fd0]
这是我的代码,
Gemfile
source 'https://rubygems.org'
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
group :development do
gem 'capistrano'
gem 'capistrano-nvm',require: false
gem 'capistrano-npm'
end
Capfile
require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
require "capistrano/nvm"
require "capistrano/npm"
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
deploy.rb
append :linked_files,".env"
append :linked_dirs,"node_modules"
set :nvm_type,:user
set :nvm_node,"v15.5.1"
set :nvm_map_bins,%w{node npm yarn}
set :npm_flags,%w{--silent --no-progress}
namespace :deploy do
task :npm_deploy do
on roles(:app) do
within fetch(:npm_target_path,release_path) do
execute fetch(:npm_bin),"build"
# execute "react-scripts build"
end
end
end
before "symlink:release",:npm_deploy
end
set :keep_releases,3
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)