简体   繁体   中英

Phoenix Edeliver release failure at npm install

I am trying to release a Elixir, Phoenix app to digital ocean server with distillery and edeliver. Whenever I do the following command, I get the error.

mix edeliver build release --verbose

Error Message

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/config

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
    "
 }

Whenever I log on to the server and npm install, it works.

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"
 }
}

server: Ubuntu 16.04.4 Nodejs v6.14.3 Elixir 1.6.5 (compiled with OTP 19)

local: macOS High Sierra

I have searched a lot and tried re-installing npm and nodejs. Changing cd '$BUILD_AT/assets' in .deliver/config, no effect. I also tried adding this in prod.exs

server: true,
code_reloader: false,
version: Mix.Project.config[:version]

still having the issue.

first connect to the server via SSH an try run npm install at the path /home/username/myapp/builds/assets this will show you the error log on your server..

This is not a solution but it gives you an idea of what is going on in your server

When I was googling a lot to solve the problem, I found a better way to deploy my app. I found a service called Nanobox

I decided to give it a try and I was able to deploy the app within few hours.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM