Skip to content
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

1.4rc : assets:precompile fails #3251

Closed
2 tasks done
skoji opened this issue May 23, 2017 · 43 comments
Closed
2 tasks done

1.4rc : assets:precompile fails #3251

skoji opened this issue May 23, 2017 · 43 comments
Labels
bug Something isn't working deployment Related to runtime configuration, production setups

Comments

@skoji
Copy link
Contributor

skoji commented May 23, 2017

assets:precompile fails on v1.4rc{1,2,3}. and v1.4.1
v1.3.3 works fine on the same machine.

CentOS 7.3.1611
Kernel 3.10.0-514.16.1.el7.x86_64
Docker version 17.03.1-ce, build c6d412e
docker-compose version 1.13.0, build 1719ceb

[Edited]
Phisical memory: 1GB
swap file : 2GB

Result:

$ /usr/local/bin/docker-compose run --rm web rails assets:precompile
Starting mastodon_redis_1 ... 
Starting mastodon_redis_1 ... done
Creating mastodon user (UID : 991 and GID : 991)...
Updating permissions...
Executing process...
yarn install v0.24.4
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.0.14: The platform "linux" is incompatible with this module.
info "fsevents@1.0.14" is an optional dependency and failed compatibility check. Excluding it from installation.
warning store@1.3.20: The engine "browser" appears to be invalid.
[3/4] Linking dependencies...  warning "react-redux-loading-bar@2.4.1" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0".
warning "chai-enzyme@0.6.1" has unmet peer dependency "react-addons-test-utils@^0.14.0 || ^15.0.0-0".
warning "react-storybook-addon-intl@0.1.0" has incorrect peer dependency "@kadira/storybook@^1.35.1".
error An unexpected error occurred: "ENOTEMPTY: directory not empty, rmdir '/mastodon/node_modules/.bin'".
info If you think this is a bug, please open a bug report with the information provided in "/mastodon/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Webpacker is installed 🎉 🍰
Using /mastodon/config/webpack/paths.yml file for setting up webpack paths
Compiling webpacker assets 🎉
sh: /mastodon/node_modules/.bin/webpack: not found
rails aborted!
JSON::ParserError: 743: unexpected token at ''
/mastodon/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:13:in `block (2 levels) in <top (required)>'
/mastodon/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:40:in `block in <top (required)>'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands.rb:18:in `<top (required)>'
/mastodon/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.2.14/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/mastodon/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.2.14/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `block in require'
/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

  • 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).
@Aldarone
Copy link
Contributor

Did you launch docker-compose build --force-rm before ?

@skoji
Copy link
Contributor Author

skoji commented May 23, 2017

@Aldarone
No, I've never used --force-rm when this problem occurs.
I tried docker-compose build --force-rm now, and the problem still occurs.

@skoji
Copy link
Contributor Author

skoji commented May 23, 2017

I have followed the following steps, and the same thing happen.

  • stop all running containers
  • remove all containers
  • remove all docker images from the machine
  • docker-compose pull
  • docker-compose build
  • docker-compose run --rm web rails assets:precompile

@skoji
Copy link
Contributor Author

skoji commented May 23, 2017

Downgrading yarn to 0.18.2 works for me, but I don't understand why this works.

--- a/Dockerfile
+++ b/Dockerfile
@@ -34,7 +34,7 @@ RUN echo "@edge https://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/reposit
     protobuf \
     su-exec \
     tini \
- && npm install -g npm@3 && npm install -g yarn \
+ && npm install -g npm@3 && npm install -g yarn@0.18.2 \
  && update-ca-certificates \
  && rm -rf /tmp/* /var/cache/apk/*

@kabuakan
Copy link

we also encountered the error on v1.4rc[2-3].

  • CentOS Linux release 7.3.1611 (3.10.0-514.16.1.el7.x86_64)
  • Docker version 17.04.0-ce, build 4845c56
  • docker-compose version 1.12.0, build b31ff33
$ docker-compose run --rm web rails assets:precompile --trace
Creating mastodon user (UID : 991 and GID : 991)...
Updating permissions...
Executing process...
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
** Invoke webpacker:yarn_install (first_time)
** Execute webpacker:yarn_install
yarn install v0.24.4
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.0.14: The platform "linux" is incompatible with this module.
info "fsevents@1.0.14" is an optional dependency and failed compatibility check. Excluding it from installation.
warning store@1.3.20: The engine "browser" appears to be invalid.
[3/4] Linking dependencies...
warning "react-redux-loading-bar@2.4.1" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0".
warning "chai-enzyme@0.6.1" has unmet peer dependency "react-addons-test-utils@^0.14.0 || ^15.0.0-0".
warning "react-storybook-addon-intl@0.1.0" has incorrect peer dependency "@kadira/storybook@^1.35.1".
error An unexpected error occurred: "ENOTEMPTY: directory not empty, rmdir '/mastodon/node_modules/.bin'".
info If you think this is a bug, please open a bug report with the information provided in "/mastodon/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
** Invoke webpacker:compile (first_time)
** Invoke webpacker:verify_install (first_time)
** Invoke webpacker:check_node (first_time)
** Execute webpacker:check_node
** Invoke webpacker:check_yarn (first_time)
** Execute webpacker:check_yarn
** Execute webpacker:verify_install
Webpacker is installed ?         ?ー
Using /mastodon/config/webpack/paths.yml file for setting up webpack paths
** Invoke environment
** Execute webpacker:compile
Compiling webpacker assets ?
sh: /mastodon/node_modules/.bin/webpack: not found
rails aborted!
JSON::ParserError: 743: unexpected token at ''
/usr/local/lib/ruby/2.4.0/json/common.rb:156:in `parse'
/usr/local/lib/ruby/2.4.0/json/common.rb:156:in `parse'
...

@akihikodaki
Copy link
Contributor

akihikodaki commented May 23, 2017

That also happens for me. I runs the task on Arch Linux and copies public/assets and public/packs to the production environment.
My CentOS is running on QEMU.

$ qemu-system-x86_64 -boot d -m 1024 -hda el7.qcow2 -net nic,vlan=0 -net user,vlan=0 -redir tcp:2222::22 -localtime -smp 4 -enable-kvm
$ ssh -p 2222 localhost
$ uname -a
Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ RAILS_ENV=production bundle exec rails assets:precompile
yarn install v0.23.2
[1/4] Resolving packages...
warning Integrity check: Lock files don't match
[2/4] Fetching packages...
warning fsevents@1.0.14: The platform "linux" is incompatible with this module.
info "fsevents@1.0.14" is an optional dependency and failed compatibility check. Excluding it from installation.
warning store@1.3.20: The engine "browser" appears to be invalid.
[3/4] Linking dependencies...
warning "react-redux-loading-bar@2.4.1" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0".
warning "chai-enzyme@0.6.1" has unmet peer dependency "react-addons-test-utils@^0.14.0 || ^15.0.0-0".
warning "react-storybook-addon-intl@0.1.0" has incorrect peer dependency "@kadira/storybook@^1.35.1".
[4/4] Building fresh packages...
success Saved lockfile.
$ npm rebuild node-sass

> node-sass@4.5.2 install /mnt/nfs/mastodon/node_modules/node-sass
> node scripts/install.js

node-sass build Binary found at /mnt/nfs/mastodon/node_modules/node-sass/vendor/linux-x64-48/binding.node

> node-sass@4.5.2 postinstall /mnt/nfs/mastodon/node_modules/node-sass
> node scripts/build.js

Binary found at /mnt/nfs/mastodon/node_modules/node-sass/vendor/linux-x64-48/binding.node
Testing binary
Binary is fine
node-sass@4.5.2 /mnt/nfs/mastodon/node_modules/node-sass
Done in 50.82s.
Webpacker is installed 🎉 🍰
Using /mnt/nfs/mastodon/config/webpack/paths.yml file for setting up webpack paths
Compiling webpacker assets 🎉
rails aborted!
JSON::ParserError: 743: unexpected token at ''
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:13:in `block (2 levels) in <top (required)>'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:40:in `block in <top (required)>'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands.rb:18:in `<top (required)>'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.2.14/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.2.14/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `block in require'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
/mnt/nfs/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)
$

@akihikodaki
Copy link
Contributor

In my case it was killed by OOM killer. Increasing RAM from 1GB to 2GB solved the issue.

@akihikodaki
Copy link
Contributor

rails/webpacker@158987a#diff-e36986293b3ec8ccf91a5c317454efcfR20 seems to fix the issue, by abandoning JSON parsing when it failed.

@unarist
Copy link
Contributor

unarist commented May 24, 2017

Reports from skoji, kabuakan and tusik (in #3273) include below lines:

error An unexpected error occurred: "ENOTEMPTY: directory not empty, rmdir '/mastodon/node_modules/.bin'".
info If you think this is a bug, please open a bug report with the information provided in "/mastodon/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Webpacker is installed 🎉 🍰
Using /mastodon/config/webpack/paths.yml file for setting up webpack paths
Compiling webpacker assets 🎉
sh: /mastodon/node_modules/.bin/webpack: not found

Webpack (.bin/webpack) doesn't seem to be successfully installed. This will still be an issue even if the error handling on the webpacker gem is fixed in rails/webpacker@158987a.

Also I found a similar report on yarnpkg/yarn#3298, but it doesn't seem to be investigated yet.

@akihikodaki
Copy link
Contributor

akihikodaki commented May 24, 2017

Oh, yes. That is just a fix for error handling.

@ghost
Copy link

ghost commented May 24, 2017

Maybe this is related:

[...]
Webpacker is installed 🎉 🍰
Using /mastodon/config/webpack/paths.yml file for setting up webpack paths
Compiling webpacker assets 🎉
rails aborted!
JSON::ParserError: 743: unexpected token at 'Webpack Bundle Analyzer saved stats file to /mastodon/public/packs/stats.json
Webpack Bundle Analyzer saved report to /mastodon/public/packs/report.html
'
/mastodon/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:13:in `block (2 levels) in <top (required)>'
/mastodon/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:40:in `block in <top (required)>'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/mastodon/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands.rb:18:in `<top (required)>'
/mastodon/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.2.14/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/mastodon/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.2.14/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `block in require'
/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
/mastodon/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)```

@nolanlawson
Copy link
Contributor

The main issue I see in the original post is:

sh: /mastodon/node_modules/.bin/webpack: not found

node_modules/.bin/webpack should be there after you run yarn install. If not, then you won't be able to run Webpack at all, so that would be the first thing to try to diagnose.

@jeroenpraat Your error looks different; oddly it seems to be caused by the webpack-bundle-analyzer or something consuming its dev output.

@Gargron
Copy link
Member

Gargron commented May 25, 2017

I didn't encounter this when installing mastodon.social, and I had to setup another instance using Docker and didn't encounter this either - so what's different in these cases?

@skoji
Copy link
Contributor Author

skoji commented May 25, 2017

Before running assets:precompile, node_modules/.bin/webpack ( which is a symbolic link to ../webpack/bin/webpack.js) exists.

But after the unsuccessful assets:precompile, ls node_modules/.bin/ outputs something like this:

ls: No such file or directory: node_modules/.bin/babel
ls: No such file or directory: node_modules/.bin/babel-doctor
...
ls: No such file or directory: node_modules/.bin/webpack
...

@akihikodaki
Copy link
Contributor

I have set up Docker on my CentOS and it worked. The only difference from @skoji's is it is running yarn install v0.24.5, not v0.24.4.

@akihikodaki
Copy link
Contributor

I confirmed it works for me even with v0.24.4.

@ghost
Copy link

ghost commented May 25, 2017

@nolanlawson Thanks, I will open a separate issue.

@skoji
Copy link
Contributor Author

skoji commented May 28, 2017

Maybe this issue caused by the bug of yarn which is fixed in yarn 0.25.3. I'll check this.
yarnpkg/yarn#2629

@cquest
Copy link

cquest commented May 29, 2017

Got the same problem with v1.4.1 and it was an OOM issue, solved with some additionnal RAM allocated to my container.

@Naouak
Copy link
Contributor

Naouak commented May 29, 2017

My instance's front is down because of this issue. The 1.4 should not have been out of RC with this kind of issue still present!

@skoji
Copy link
Contributor Author

skoji commented May 30, 2017

0.25.3 does not work.

@skoji
Copy link
Contributor Author

skoji commented May 31, 2017

I've tested on a machine with 4GB memory + 2GB swap, and the problem is still there.

@nolanlawson
Copy link
Contributor

nolanlawson commented May 31, 2017

Hm, can you try disabling the WebpackBundleAnalyzer and see if that helps? I'm trying to think of any parts of the Webpack build process that could reasonably be disabled. I have no idea how much memory each part takes up.

To disable it, just comment out these lines.

@nolanlawson
Copy link
Contributor

Errrr wait, are you still seeing sh: /mastodon/node_modules/.bin/webpack: not found? So is yarn just not able to install at all? Maybe try npm install instead of yarn?

@akihikodaki akihikodaki added bug Something isn't working deployment Related to runtime configuration, production setups labels May 31, 2017
@nolanlawson
Copy link
Contributor

nolanlawson commented May 31, 2017

Also, for anyone feeling absolutely stuck on this issue: you can always rsync the files to another machine, run yarn and assets:precompile there, and then rsync the files back.

@bgcarlisle
Copy link

I'm still getting this issue, not sure how to resolve:

$ RAILS_ENV=production bundle exec rails assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
** Invoke webpacker:yarn_install (first_time)
** Execute webpacker:yarn_install
yarn install v0.22.0
[1/4] Resolving packages...
success Already up-to-date.
$ npm rebuild node-sass

> node-sass@4.5.3 install /home/mastodon/live/node_modules/node-sass
> node scripts/install.js

node-sass build Binary found at /home/mastodon/live/node_modules/node-sass/vendor/linux-x64-51/binding.node

> node-sass@4.5.3 postinstall /home/mastodon/live/node_modules/node-sass
> node scripts/build.js

Binary found at /home/mastodon/live/node_modules/node-sass/vendor/linux-x64-51/binding.node
Testing binary
Binary is fine
node-sass@4.5.3 /home/mastodon/live/node_modules/node-sass
Done in 18.50s.
** Invoke webpacker:compile (first_time)
** Invoke webpacker:verify_install (first_time)
** Invoke webpacker:check_node (first_time)
** Execute webpacker:check_node
** Invoke webpacker:check_yarn (first_time)
** Execute webpacker:check_yarn
** Execute webpacker:verify_install
Webpacker is installed 🎉 🍰
Using /home/mastodon/live/config/webpack/paths.yml file for setting up webpack paths
** Invoke environment 
** Execute webpacker:compile
Compiling webpacker assets 🎉
Killed
rails aborted!
JSON::ParserError: 743: unexpected token at ''
/home/mastodon/.rbenv/versions/2.4.1/lib/ruby/2.4.0/json/common.rb:156:in `parse'
/home/mastodon/.rbenv/versions/2.4.1/lib/ruby/2.4.0/json/common.rb:156:in `parse'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:13:in `block (2 levels) in <top (required)>'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/home/mastodon/.rbenv/versions/2.4.1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:40:in `block in <top (required)>'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/home/mastodon/.rbenv/versions/2.4.1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:152:in `invoke_task'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `each'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `block in top_level'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.0.3/lib/rails/commands.rb:18:in `<top (required)>'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-0.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `block in require'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => webpacker:compile

@nightpool
Copy link
Member

@bgcarlisle Looks like that's a completely different error: Compiling webpacker assets 🎉, Killed, rails aborted vs sh: /mastodon/node_modules/.bin/webpack: not found

@bgcarlisle
Copy link

Apologies, still stumped though!

@fredix
Copy link

fredix commented May 31, 2017

Hi, I confirm that the docker image 1.4.1 failed because of yarn ...
I build my own image with yarn 0.18.2 https://hub.docker.com/r/fredix/mastodon/ and mastodon works now.

@bgcarlisle
Copy link

Mine turned out to be messed up because I didn't have enough RAM

Used a swap file and now it's up and running!

@skoji
Copy link
Contributor Author

skoji commented Jun 1, 2017

@nolanlawson

Also, for anyone feeling absolutely stuck on this issue: you can always rsync the files to another machine, run yarn and assets:precompile there, and then rsync the files back.

I tried this on my mac (16GB memory / 2GB memory for Docker). This works for me.

@ftkro
Copy link

ftkro commented Jun 1, 2017

I encountered same issue. My server memory is 2GB, and swap is 1GB. I'll investigate deeply, and try to fix it.
I tried to update yarn before execute precompile, but it was did not make sense.

COMPOSE_HTTP_TIMEOUT=9999 /usr/local/bin/docker-compose run --rm web npm upgrade --global yarn
COMPOSE_HTTP_TIMEOUT=9999 /usr/local/bin/docker-compose run --rm web bundle exec rails assets:precompile

I don't have computer that has big/huge memory...

@skoji
Copy link
Contributor Author

skoji commented Jun 1, 2017

@takutaku947
I think you meant to upgrade yarn, but the container with upgraded yarn will removed immediately when the first docker-compose run finished.

You should do something like this:

docker-compose run --rm web sh -c 'npm upgrade --global yarn && rails assets:precompile'

(You can install newer yarn by editing Dockerfile)

@ftkro
Copy link

ftkro commented Jun 1, 2017

@skoji Yes, I meant "upgrade". Thank you for let me know. I'll try it after sleep!(6AM, trying to fix all night!) ありがとう(Thanks again)!

@ftkro
Copy link

ftkro commented Jun 1, 2017

I woke up and running job in background. Now, I solved that problem. Thank you!

@amazedkoumei
Copy link
Contributor

$ docker-compose run --rm web rails assets:precompile
This command fails with same error logs

$ docker-compose run --rm web rails webpacker:compile
But this command gets success in spite of this command calls vendor/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:13

I don't know why.
Does anyone know why ?

@M-D-M
Copy link

M-D-M commented Jun 15, 2017

Not running docker, and was having this problem -- I can confirm it was because of RAM, weirdly enough! Running mastodon on a VM with 2GB of RAM, and the assets:precompile would only work when I killed off a lot of other junk running on the server to free up RAM.

@skoji
Copy link
Contributor Author

skoji commented Jun 21, 2017

In v1.4.4 assets:precompile does not invoke yarn, so this problem seems to be fixed.

@skoji
Copy link
Contributor Author

skoji commented Jun 21, 2017

I think the problem in the original post is fixed, so closing this issue.

@skoji skoji closed this as completed Jun 21, 2017
@Naouak
Copy link
Contributor

Naouak commented Jun 21, 2017

The "fix" is not really working, the issue is a lot more than just yarn version. The issue is that assets:precompile uses too much ram for what it does and real tests should be used to determine if it's using an acceptable amount of memory now.

@skoji
Copy link
Contributor Author

skoji commented Jun 21, 2017

Maybe there are still some other problems in the process of assets:precompile, but this specific problem has been fixed with v1.4.4 (maybe by the new version of webpacker).

If there is a different problem, a different issue is needed for that.

@Naouak
Copy link
Contributor

Naouak commented Jun 21, 2017

I've got the exact issue reported here with suggested yarn version used to "fix" this issue in v1.4.1. I still haven't tried to upgrade to latest version because of that.

@skoji
Copy link
Contributor Author

skoji commented Jun 21, 2017

@Naouak v1.4.4 works for me without the workaround (specify yarn version).
If the problem reproduces with v1.4.4, this issue should be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deployment Related to runtime configuration, production setups
Projects
None yet
Development

No branches or pull requests

16 participants