Open hhutch opened 10 years ago
assets:precompile
should be run in production
environment, so RAILS_ENV=production rake assets:precompile
or simply rake assets:precompile
, because this task uses the production
environment by default, I think.
Does this fix it?
I get the same error running precompiled assets in both production and development modes. I am attempting to deploy to Heroku. Running with browserify-rails in development, not recompiling assets, works well.
I am using both NPM installed node_modules and writing many of my own components for use in a React UI.
Hi. I'm having this very same issue on Rails 3.2.17. What I am observing is that the Rails engine is not being registered when I run rake assets:precompile
. It works fine with development-mode runtime asset compilation.
It's also not clear from the Readme which versions of Rails are supported. I would guess at least 3.2 and up?
It works fine when I run RAILS_ENV=production rake assets:precompile
on my local.
But it throw the following error message when I push to heroku master:
Cleaning up the bundler cache.
-----> Using Node.js version: 0.10.21
-----> Installing JavaScript dependencies using Bower 1.3.9
bower moment#* cached git://github.com/moment/moment.git#2.8.3
bower moment#* validate 2.8.3 against git://github.com/moment/moment.git#*
bower moment#* install moment#2.8.3
moment#2.8.3 bower_components/moment
Cleaning up the bower tmp.
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
BrowserifyRails::BrowserifyError: browserify could not be found at /tmp/build_150c72a7-cb5c-425c-99d0-1fdafc780a27/./node_modules/.bin/browserify. Please run npm install.
(in /tmp/build_150c72a7-cb5c-425c-99d0-1fdafc780a27/app/assets/javascripts/components.js)
I've got same error as michael-ns when pushing to heroku. If I include node-modules folder into the repo I get Errno::EPIPE: Broken pipe
error. Any suggestions?
As a workaround you can disable asset compilation for production and sync manually with rake assets:precompile RAILS_ENV=production
I'm having the same problem.
Currently doing what @ikido suggested and it works but it's not the ideal.
I had same issue as @michael-ns and found the solution. Here is what I did. http://ryochikazawa.com/2015/01/30/heroku-with-browserify-rails.html
@chikathreesix thanks a lot for finding the solution to this. Anyway, when you write:
Create .buildpack file for the multi-buildpack to make sure node.js is compiled before ruby.
I think the file has to be named .buildpacks instead of .buildpack (http://stackoverflow.com/a/14801582)
@joaovpmamede thank you for pointing this out. Yeah, you're correct. I've fixed the blog post.
Hello I have the same issue with this output and rails setup https://gist.github.com/kfamilonidis/e21e2b7e088732e684fb I haven't found any resolution yet other than to manually run.
NODE_VERSION=v5.0.0 RAILS_ENV=production /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile
=== UPDATE
solved - I replaced the double quotes with single ones on the browserify parameters and worked!
config.browserify_rails.commandline_options = "--transform reactify --extension='.jsx'"
insead of
config.browserify_rails.commandline_options = "--transform reactify --extension=\".jsx\" ".
@kfamilonidis It's awesome that you found a fix for this issue, thanks! Active development for browserify-rails has actually moved to https://github.com/browserify-rails/browserify-rails
, so it'd be great if you could share your findings there :)
Steps to reproduce:
RESULT: browserify does not compile into a single JS asset and individual JS files (such as React libraries) are loaded but throw errors
Please let me know if I am making some sort of mistake, but as of now I have to revert to manual compilation as recommended in issue #27