New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails assets:precompile fails when upgrading from 1.2.2 to 1.3.1 #2595

Closed
gilir opened this Issue Apr 28, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@gilir

gilir commented Apr 28, 2017

When running docker-compose run --rm web rails assets:precompile during the upgrade process between 1.2.2 and 1.3.1, the command failed with this error :

$ docker-compose run --rm mastodon-web rails assets:precompile --trace
Creating mastodon-redis
Creating mastodon-db
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rails aborted!
BrowserifyRails::BrowserifyError: Error while running /mastodon/node_modules/.bin/browserify --transform babelify --extension=".jsx" -o "/mastodon/tmp/cache/browserify-rails/output20170428-1-jwa04e" -:

/mastodon/app/assets/javascripts/components/emoji.jsx:1
import emojione from 'emojione';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
/mastodon/vendor/bundle/ruby/2.4.0/gems/browserify-rails-4.1.0/lib/browserify-rails/browserify_processor.rb:221:in run_browserify' /mastodon/vendor/bundle/ruby/2.4.0/gems/browserify-rails-4.1.0/lib/browserify-rails/browserify_processor.rb:52:incall'
/mastodon/vendor/bundle/ruby/2.4.0/gems/browserify-rails-4.1.0/lib/browserify-rails/browserify_processor.rb:16:in call' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:incall_processor'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in block in call_processors' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:inreverse_each'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in call_processors' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:inload_from_unloaded'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in block in load' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:infetch_asset_from_dependency_cache'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in load' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:inblock in initialize'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in load' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:23:inblock in call'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/utils.rb:200:in dfs' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:24:incall'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in call_processor' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:inblock in call_processors'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in reverse_each' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:incall_processors'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in load_from_unloaded' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:inblock in load'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in fetch_asset_from_dependency_cache' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:inload'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in block in initialize' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:inload'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in find_asset' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:infind_all_linked_assets'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:134:in block in find' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:133:ineach'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:133:in find' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:incompile'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in block (3 levels) in define' /mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:inwith_logger'
/mastodon/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in block (2 levels) in define' /mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:inblock in execute'
/mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in each' /mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:inexecute'
/mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in block in invoke_with_call_chain' /usr/local/lib/ruby/2.4.0/monitor.rb:214:inmon_synchronize'
/mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in invoke_with_call_chain' /mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:ininvoke'
/mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:152:in invoke_task' /mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:inblock (2 levels) in top_level'
/mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in each' /mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:inblock in top_level'
/mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:117:in run_with_threads' /mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:102:intop_level'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:14:in block in run_rake_task' /mastodon/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:178:instandard_exception_handling'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:11:in run_rake_task' /mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:51:inrun_command!'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in <top (required)>' bin/rails:4:inrequire'
bin/rails:4:in `

'
Tasks: TOP => assets:precompile

I tried twice to do the upgrade, but it failed with the same error. So far, my instance runs normally with 1.3.1 release, so I'm not sure it's a big deal.

Let me know if you need more information about this issue.


  • I searched or browsed the repo’s other issues to ensure this is not a duplicate.
  • This bug happens on a tagged release and not on master (If you're a user, don't worry about this).
@mjankowski

This comment has been minimized.

Show comment
Hide comment
@mjankowski

mjankowski Apr 28, 2017

Collaborator

Did you run bundle install and/or npm install after updating but before attempting asset compilation?

Collaborator

mjankowski commented Apr 28, 2017

Did you run bundle install and/or npm install after updating but before attempting asset compilation?

@gilir

This comment has been minimized.

Show comment
Hide comment
@gilir

gilir Apr 28, 2017

No, I rebuild a docker image with the 1.3.1 release, and it build fine. So I assume I have all the needed dependencies.
Apparently, I'm not the only one having this issue : https://lists.ffdn.org/wws/arc/mastodon-admin/2017-04/msg00447.html
After some hours of testing, my 1.3.1 instance didn't get any updates for others instances, so maybe the problem in assets compilation broke something after all.

gilir commented Apr 28, 2017

No, I rebuild a docker image with the 1.3.1 release, and it build fine. So I assume I have all the needed dependencies.
Apparently, I'm not the only one having this issue : https://lists.ffdn.org/wws/arc/mastodon-admin/2017-04/msg00447.html
After some hours of testing, my 1.3.1 instance didn't get any updates for others instances, so maybe the problem in assets compilation broke something after all.

@uehatsu

This comment has been minimized.

Show comment
Hide comment
@uehatsu

uehatsu May 2, 2017

Hi, I tried to build Raspberry Pi instance with gilir's rpi-mastodon repository.
And same error occured.

I checked gilir's Dockerfile, I found a bug "dot files aren't mv to top directory".

https://gogs.lavergne.online/gilir/rpi-mastodon.git

pi@mastodon:/var/lib/rpi-mastodon $ git diff Dockerfile
diff --git a/Dockerfile b/Dockerfile
index 6fde164..f246236 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,6 +18,7 @@ ADD https://github.com/tootsuite/mastodon/archive/v${MASTODON_VERSION}.tar.gz .
 RUN tar -xvf v${MASTODON_VERSION}.tar.gz \
  && mkdir -p /tmp/mastodon/build/ \
  && mv mastodon-*/* /tmp/mastodon/build/ \
+ && mv mastodon-*/.[^\.]* /tmp/mastodon/build/ \
  && rm -f v${MASTODON_VERSION}.tar.gz \

 WORKDIR /mastodon

Now, I'm rebuilding mastodon-web docker image.

uehatsu commented May 2, 2017

Hi, I tried to build Raspberry Pi instance with gilir's rpi-mastodon repository.
And same error occured.

I checked gilir's Dockerfile, I found a bug "dot files aren't mv to top directory".

https://gogs.lavergne.online/gilir/rpi-mastodon.git

pi@mastodon:/var/lib/rpi-mastodon $ git diff Dockerfile
diff --git a/Dockerfile b/Dockerfile
index 6fde164..f246236 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,6 +18,7 @@ ADD https://github.com/tootsuite/mastodon/archive/v${MASTODON_VERSION}.tar.gz .
 RUN tar -xvf v${MASTODON_VERSION}.tar.gz \
  && mkdir -p /tmp/mastodon/build/ \
  && mv mastodon-*/* /tmp/mastodon/build/ \
+ && mv mastodon-*/.[^\.]* /tmp/mastodon/build/ \
  && rm -f v${MASTODON_VERSION}.tar.gz \

 WORKDIR /mastodon

Now, I'm rebuilding mastodon-web docker image.

@uehatsu

This comment has been minimized.

Show comment
Hide comment
@uehatsu

uehatsu May 2, 2017

OOPS, another line "cp *" exist.

pi@mastodon:/var/lib/rpi-mastodon $ git diff Dockerfile
diff --git a/Dockerfile b/Dockerfile
index 6fde164..393af8c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,6 +18,7 @@ ADD https://github.com/tootsuite/mastodon/archive/v${MASTODON_VERSION}.tar.gz .
 RUN tar -xvf v${MASTODON_VERSION}.tar.gz \
  && mkdir -p /tmp/mastodon/build/ \
  && mv mastodon-*/* /tmp/mastodon/build/ \
+ && mv mastodon-*/.[^\.]* /tmp/mastodon/build/ \
  && rm -f v${MASTODON_VERSION}.tar.gz \

 WORKDIR /mastodon
@@ -53,6 +54,7 @@ RUN cp /tmp/mastodon/build/Gemfile . \
  && apk del build-dependencies \
  && rm -rf /var/cache/apk/* \
  && cp -r /tmp/mastodon/build/* . \
+ && cp -r /tmp/mastodon/build/.[^\.]* . \
  && rm -rf /tmp/mastodon/

 VOLUME /mastodon/public/system /mastodon/public/assets

uehatsu commented May 2, 2017

OOPS, another line "cp *" exist.

pi@mastodon:/var/lib/rpi-mastodon $ git diff Dockerfile
diff --git a/Dockerfile b/Dockerfile
index 6fde164..393af8c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,6 +18,7 @@ ADD https://github.com/tootsuite/mastodon/archive/v${MASTODON_VERSION}.tar.gz .
 RUN tar -xvf v${MASTODON_VERSION}.tar.gz \
  && mkdir -p /tmp/mastodon/build/ \
  && mv mastodon-*/* /tmp/mastodon/build/ \
+ && mv mastodon-*/.[^\.]* /tmp/mastodon/build/ \
  && rm -f v${MASTODON_VERSION}.tar.gz \

 WORKDIR /mastodon
@@ -53,6 +54,7 @@ RUN cp /tmp/mastodon/build/Gemfile . \
  && apk del build-dependencies \
  && rm -rf /var/cache/apk/* \
  && cp -r /tmp/mastodon/build/* . \
+ && cp -r /tmp/mastodon/build/.[^\.]* . \
  && rm -rf /tmp/mastodon/

 VOLUME /mastodon/public/system /mastodon/public/assets
@gilir

This comment has been minimized.

Show comment
Hide comment
@gilir

gilir May 2, 2017

I'm not sure adding the hidden files are necessary, but I'm interesting to see if it's fix the problem.
FYI, I have the same problem with 1.3.2. However, I'm running my instance with 1.3.2 code without any problem so far (but it's a very low traffic instance).

gilir commented May 2, 2017

I'm not sure adding the hidden files are necessary, but I'm interesting to see if it's fix the problem.
FYI, I have the same problem with 1.3.2. However, I'm running my instance with 1.3.2 code without any problem so far (but it's a very low traffic instance).

@uehatsu

This comment has been minimized.

Show comment
Hide comment
@uehatsu

uehatsu May 2, 2017

.babelrc is need for compiling ".jsx" files.

uehatsu commented May 2, 2017

.babelrc is need for compiling ".jsx" files.

@gilir

This comment has been minimized.

Show comment
Hide comment
@gilir

gilir May 4, 2017

Thanks @uehatsu, I just rebuild my image with your changes, and the assets are building OK :-)
I also checked the official docker image, and the dot files are there also, so it's probably only my image which is affected. I still don't know why others people are having the same problem using another image.

gilir commented May 4, 2017

Thanks @uehatsu, I just rebuild my image with your changes, and the assets are building OK :-)
I also checked the official docker image, and the dot files are there also, so it's probably only my image which is affected. I still don't know why others people are having the same problem using another image.

@gilir gilir closed this May 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment