Copser

Copser OP

I have a Heroku deploy problem, currently, it’s failing on installing package.json and the error is

remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Phoenix app detected
remote:
remote: -----> Loading configuration and environment
remote:        Loading config...
remote:        WARNING: phoenix_static_buildpack.config wasn't found in the app
remote:        Using default config from Phoenix static buildpack
remote:        Detecting assets directory
remote:        WARNING: no package.json detected in root nor custom directory
remote:        * assuming phoenix 1.3.x and later, please check config file
remote:        Will use phoenix configuration:
remote:        * assets path assets
remote:        * mix tasks namespace phx
remote:        Will use the following versions:
remote:        * Node 6.9.2
remote:        Will export the following config vars:
remote: DATABASE_URL
remote: NODE_MODULES_CACHE
remote: POOL_SIZE
remote: SECRET_KEY_BASE
remote:        * MIX_ENV=prod
remote: -----> Installing binaries
remote: Resolving node version 6.9.2...
remote: Downloading and installing node 6.9.2...
remote:        Installing Node 6.9.2...
remote:        Using default npm version
remote:
remote: -----> Building dependencies
remote:        Installing and caching node modules
remote: npm WARN package.json @ No description
remote: npm WARN package.json @ No README data
remote:        npm ERR! addLocal Could not install /tmp/build_86e0734371e98eb49ec08fbf671e37ba/deps/phoenix
remote:        npm ERR! addLocal Could not install /tmp/build_86e0734371e98eb49ec08fbf671e37ba/deps/phoenix_html
remote:        npm ERR! Linux 4.4.0-1057-aws
remote:        npm ERR! argv "/tmp/build_86e0734371e98eb49ec08fbf671e37ba/.heroku/node/bin/node" "/tmp/build_86e0734371e98eb49ec08fbf671e37ba/.heroku/node/bin/npm" "install" "--quiet" "--unsafe-perm" "--userconfig" "/tmp/build_86e0734371e98eb49ec08fbf671e37ba/npmrc"
remote:        npm ERR! node v6.9.2
remote:        npm ERR! npm  v3.10.9
remote:        npm ERR! path /tmp/build_86e0734371e98eb49ec08fbf671e37ba/deps/phoenix
remote:        npm ERR! code ENOENT
remote:        npm ERR! errno -2
remote:        npm ERR! syscall open
remote:
remote:        npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_86e0734371e98eb49ec08fbf671e37ba/deps/phoenix'
remote:        npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_86e0734371e98eb49ec08fbf671e37ba/deps/phoenix'
remote:        npm ERR! enoent This is most likely not a problem with npm itself
remote:        npm ERR! enoent and is related to npm not being able to find a file.
remote:        npm ERR! enoent
remote:
remote:        npm ERR! Please include the following file with any support request:
remote:        npm ERR!     /tmp/build_86e0734371e98eb49ec08fbf671e37ba/assets/npm-debug.log
remote:  !     Push rejected, failed to compile Phoenix app.

I have tried https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache, also I have elixir-buildpack.config

elixir_version=1.8.2
erlang_version=21.2.5
assets_path=assets
phoenix_ex=phx

and phoenix_static_buildpack.config

clean_cache=true
compile="compile"
config_vars_to_export=(DATABASE_URL)
node_version=6.9.5
npm=3.10.8
phoenix_relative_path=.
remove_node=false

package.json is the default one

{
  "repository": {},
  "license": "MIT",
  "scripts": {
    "deploy": "webpack --mode production",
    "watch": "webpack --mode development --watch"
  },
  "dependencies": {
    "phoenix": "file:../deps/phoenix",
    "phoenix_html": "file:../deps/phoenix_html"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "babel-loader": "^8.0.0",
    "copy-webpack-plugin": "^4.5.0",
    "css-loader": "^2.1.1",
    "mini-css-extract-plugin": "^0.4.0",
    "optimize-css-assets-webpack-plugin": "^4.0.0",
    "uglifyjs-webpack-plugin": "^1.2.4",
    "webpack": "4.4.0",
    "webpack-cli": "^2.0.10"
  }
}

but still no joy in solving the error above, did someone had something similar, how did you solved it? Thanks

First 10 of 11 Posts Switch mode

Copser

Copser OP

I have manage to solve WARNING: no package.json detected in root nor custom directory by adding assets_path="." instead of phoenix_relative_path but no joy I’m still having problems with not been able to deploy the app properly, I don’t understand why he can’t see deps folder

tenzil

tenzil

Can you try the following
in phoenix_static_buildpack.config, set node version above 8 (i got errors on node modules for lesser versions)
or set node_version=10.15.0

Copser

Copser OP

ok so changing node version helped but now this

remote:        * MIX_ENV=prod
remote:
remote: -----> Installing binaries
remote:        clean_cache option set to true.
remote:        Cleaning out cache contents
remote: Resolving node version 10.15.0...
remote: Downloading and installing node 10.15.0...
remote:        Installing Node 10.15.0...
remote:        Using default npm version
remote:
remote: -----> Building dependencies
remote:        Installing and caching node modules
remote: npm WARN assets No description
remote:
remote:        up to date in 0.45s
remote:        found 0 vulnerabilities
remote:
remote:        npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
remote:        npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
remote:        npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
remote:        npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
remote:        npm ERR! code ENOLOCAL
remote:        npm ERR! Could not install from "../deps/phoenix" as it does not contain a package.json file.
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /app/.npm/_logs/2019-12-29T07_33_56_086Z-debug.log
remote:  !     Push rejected, failed to compile Phoenix app.
remote:
remote:  !     Push failed
remote: Verifying deploy...```

this is a nightmare :cry:
tenzil

tenzil

hmm ok, now thats a path issue.
Thought of two things,

  1. With node 10.15, Incase if you dont have asset_path in phoenix_static_buildpack, add it (assets_path=.) and update always_rebuild=true in elixir_buildpack.config.
    2.If that didn’t work, can you try reverting back to old version (node 6.9.2) and try the same.
Copser

Copser OP

so in my phoenix_static_buildpack I have defined

assets_path=.
clean_cache=true
node_version=10.18.0
npm_version=6.13.4

and in elixir_buildpack.config I have defined

always_rebuild=true
elixir_version=1.8.2
erlang_version=21.2.5

reverting back to old version did not solve the problem, I would really love if elixir didn’t use npm but yarn.

tenzil

tenzil

anyluck with the node 10.15, with the same settings? or the same error persist?

Copser

Copser OP

it’s the same.

Enumerating objects: 326, done.
Counting objects: 100% (326/326), done.
Delta compression using up to 12 threads
Compressing objects: 100% (224/224), done.
Writing objects: 100% (326/326), 190.93 KiB | 9.09 MiB/s, done.
Total 326 (delta 139), reused 202 (delta 79)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Phoenix app detected
remote:
remote: -----> Loading configuration and environment
remote:        Loading config...
remote:        Detecting assets directory
remote:        * package.json found in custom directory
remote:        Will use phoenix configuration:
remote:        * assets path ./assets
remote:        * mix tasks namespace phoenix
remote:        Will use the following versions:
remote:        * Node 10.18.0
remote:        Will export the following config vars:
remote: DATABASE_URL
remote: NODE_MODULES_CACHE
remote: POOL_SIZE
remote: SECRET_KEY_BASE
remote:        * MIX_ENV=prod
remote:
remote: -----> Installing binaries
remote:        clean_cache option set to true.
remote:        Cleaning out cache contents
remote: Resolving node version 10.18.0...
remote: Downloading and installing node 10.18.0...
remote:        Installing Node 10.18.0...
remote:        Using default npm version
remote:
remote: -----> Building dependencies
remote:        Installing and caching node modules
remote: npm WARN . No description
remote:
remote:        up to date in 0.336s
remote:        found 0 vulnerabilities
remote:
remote:        npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
remote:        npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
remote:        npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
remote:        npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
remote:        npm ERR! code ENOLOCAL
remote:        npm ERR! Could not install from "../deps/phoenix" as it does not contain a package.json file.
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /app/.npm/_logs/2019-12-29T08_10_45_268Z-debug.log
remote:  !     Push rejected, failed to compile Phoenix app.
remote:
remote:  !     Push failed
remote: Verifying deploy...

why should I ever change the deps path, I don’t get it, I have spent four hours on this.

tenzil

tenzil

Hey found a similar thread in elixirforum, please check and try this

And this one as well
https://github.com/gigalixir/gigalixir-getting-started/issues/8#issuecomment-529055892

Copser

Copser OP

OMG, I didn’t set the elixir build pack so I was not building it properly, thanks @tenzil I need to go and chill a bit :smile:

After I did heroku create --buildpack hashnuke/elixir I forgot to heroku buildpacks:set hashnuke/elixir, and that was it, people read the documentation :blush:

outlog

outlog

you can easily use yarn, or parcel - or whatever is the latest and greatest..

I use yarn on heroku - I just have a yarn deploy in my compile file - which of course calls the deploy script in package.json..

  "scripts": {
    "deploy": "NODE_ENV=production webpack --mode production",

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

We're in Beta

About us Mission Statement