我正在尝试将Elixir,Phoenix应用程序发布到带有酒厂和电子邮件的数字海洋服务器。每当我执行以下命令时,我都会收到错误。
mix edeliver build release --verbose
错误消息
A remote command failed on:
username@server-ip
Output of the command is shown above and the command executed
on that host is printed below for debugging purposes:
FAILED with exit status 255:
[ -f ~/.profile ] && source ~/.profile
set -e
cd '/home/username/myapp/builds/assets'
npm install
mix.exs
{:distillery, "~> 1.4"},
{:edeliver, "~> 1.4.3"}
.deliver /配置
APP="myapp"
BUILD_HOST="server-ip"
BUILD_USER="username"
BUILD_AT="/home/username/myapp/builds"
PRODUCTION_HOSTS="server-ip"
PRODUCTION_USER="username"
DELIVER_TO="/home/username"
pre_erlang_clean_compile() {
status "Installing NPM dependencies"
__sync_remote "
[ -f ~/.profile ] && source ~/.profile
set -e
cd '$BUILD_AT/assets'
npm install $SILENCE
"
status "Building static files"
__sync_remote "
[ -f ~/.profile ] && source ~/.profile
set -e
cd '$BUILD_AT'
mkdir -p priv/static
npm run deploy $SILENCE
"
status "Running phoenix.digest"
__sync_remote "
[ -f ~/.profile ] && source ~/.profile
set -e
cd '$BUILD_AT'
APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phoenix.digest $SILENCE
"
}
每当我登录服务器并安装npm时,它都能正常工作。
的package.json
{
"repository": {},
"license": "MIT",
"scripts": {
"deploy": "brunch build --production",
"watch": "brunch watch --stdin"
},
"dependencies": {
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html"
},
"devDependencies": {
"babel-brunch": "6.1.1",
"brunch": "2.10.9",
"clean-css-brunch": "2.10.0",
"uglify-js-brunch": "2.10.0"
}
}
服务器: Ubuntu 16.04.4 Nodejs v6.14.3 Elixir 1.6.5(用OTP 19编译)
本地: macOS High Sierra
我搜索了很多,并尝试重新安装npm和nodejs。更改cd' $ BUILD_AT / assets'在.deliver / config中,没有效果。 我也尝试在prod.exs中添加它
server: true,
code_reloader: false,
version: Mix.Project.config[:version]
仍有问题。
答案 0 :(得分:0)
首先通过SSH连接到服务器,在路径npm install
上尝试运行/home/username/myapp/builds/assets
,这将显示服务器上的错误日志..
这不是一个解决方案,但它可以让您了解服务器中发生了什么
答案 1 :(得分:-1)
当我谷歌搜索解决问题时,我发现了一种更好的方式来部署我的应用程序。我找到了一项名为Nanobox
的服务我决定尝试一下,我可以在几个小时内部署应用程序。