ex_admin icon indicating copy to clipboard operation
ex_admin copied to clipboard

** (Mix) Can't find brunch-config.js

Open debonair opened this issue 8 years ago • 10 comments

On phoenix 1.3, when i run:

mix admin.install

I get :

** (Mix) Can't find brunch-config.js

debonair avatar Sep 16 '17 07:09 debonair

I have the same issue. Using it with an umbrella project with Phoenix 1.3 and Elixir 1.4.

szabolcsmaj avatar Sep 17 '17 23:09 szabolcsmaj

This is not an official fix, but if you are stuck like me and need a solution right now, here is one. I found this closed PR https://github.com/smpallen99/ex_admin/pull/388/files You can make the same changes that he did, then recomplie the deps mix deps.compile then one more time try mix admin.install and you're good to go.

I think his PR was rejected because it breaks compatibility with previous phoenix versions. If you are only on 1.3 like me, I would say go ahead.

happysalada avatar Sep 28 '17 19:09 happysalada

Actually, the fix I recommended is just for the install script. But since phoenix 1.3 is completely different, exadmin is broken even with that fix. The install script needs to be rewritten. So sorry guys, no quick solution for now.

happysalada avatar Sep 28 '17 19:09 happysalada

I got the same issue with Phoenix 1.3.0 😢

franzejr avatar Sep 28 '17 20:09 franzejr

Quick solution: mix admin.install --no-brunch.

franzejr avatar Sep 28 '17 20:09 franzejr

accessing the admin interface after that will still give you an error though.

happysalada avatar Sep 28 '17 23:09 happysalada

Hello @franzejr , The error is still there when using --no-brunch also. I am getting ** (Mix) Can't find assets path! by manually create assets folder in the root the error still remains.

blisscs avatar Oct 24 '17 10:10 blisscs

I worked around this error with ln -s assets/brunch-config.js .. But still it created non compatible config, so I had to adjust it along Phoenix 1.3

Kukunin avatar Oct 30 '17 10:10 Kukunin

Hi, @Kukunin Did you make it work. What work around did you do? I am still got stuck on the ** (Mix) Can't find assets path! My phoenix is generated using mix phx [project_name] --no-brunch I did create assets directory under the root path and web path (by creating web directory also to make it like phoenix 1.2).

If anybody have feedback please recommend.

  • Dev

blisscs avatar Nov 23 '17 07:11 blisscs

Yeah, it made it work. Since the generator expects the Phoenix 1.2 file structure, you need to migrate everything to 1.3. I might be wrong since it was a month ago, but here is an idea.

It expects:

  • /brunch-config.js
  • /priv/static folder
  • /web folder

After it installs everything, use git diff to find changes and migrate them onto 1.3 version:

  • make brunch changes in /assets/brunch-config.js
  • move assets from /priv/static to /assets folder. In my case I have:
    • /assets/static/fonts/
    • /assets/static/images/
    • /assets/vendor/ <- js and css files here
  • move every class from /web to /lib/your_app_web

Here is my brunch-config.js with ExAdmin support for a reference

exports.config = {
  // See http://brunch.io/#documentation for docs.
  files: {
    javascripts: {
      joinTo: {
        "js/app.js": /^(js)|(node_modules)/,
        "js/ex_admin_common.js": ["vendor/ex_admin_common.js"],
        "js/admin_lte2.js": ["vendor/admin_lte2.js"],
        "js/jquery.min.js": ["vendor/jquery.min.js"]
      }
    },
    stylesheets: {
      joinTo: {
        "css/app.css": /^(css)/,
        "css/admin_lte2.css": ["vendor/admin_lte2.css"],
        "css/active_admin.css.css": ["vendor/active_admin.css.css"]
      }
    },
    templates: {
      joinTo: "js/app.js"
    }
  },

  conventions: {
    // This option sets where we should place non-css and non-js assets in.
    // By default, we set this to "/assets/static". Files in this directory
    // will be copied to `paths.public`, which is "priv/static" by default.
    assets: /^(static)/
  },

  // Phoenix paths configuration
  paths: {
    // Dependencies and current project directories to watch
    watched: ["static", "css", "js", "vendor"],
    // Where to compile files to
    public: "../priv/static"
  },

  // Configure your plugins
  plugins: {
    copycat: {
      "fonts": ["node_modules/font-awesome/fonts"]
    },
    babel: {
      presets: ["es2015", "react"],
      plugins: ["transform-object-rest-spread"],
      // Do not use ES6 compiler in vendor code
      ignore: [/vendor/]
    },
    sass: {
      mode: 'native',
      options: {
        includePaths: ["node_modules/bootstrap/scss", "node_modules/font-awesome/scss"],
        precision: 8
      }
    }
  },

  modules: {
    autoRequire: {
      "js/app.js": ["js/app"]
    }
  },

  npm: {
    enabled: true
  }
};

Kukunin avatar Nov 23 '17 13:11 Kukunin