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 [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "browser" appears to be invalid.
[3/4] Linking dependencies... warning "[email protected]" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0".
warning "[email protected]" has unmet peer dependency "react-addons-test-utils@^0.14.0 || ^15.0.0-0".
warning "[email protected]" 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)
master (If you're a user, don't worry about this).Did you launch docker-compose build --force-rm before ?
@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.
I have followed the following steps, and the same thing happen.
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 [email protected] \
&& update-ca-certificates \
&& rm -rf /tmp/* /var/cache/apk/*
we also encountered the error on v1.4rc[2-3].
$ 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 [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "browser" appears to be invalid.
[3/4] Linking dependencies...
warning "[email protected]" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0".
warning "[email protected]" has unmet peer dependency "react-addons-test-utils@^0.14.0 || ^15.0.0-0".
warning "[email protected]" 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'
...
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 [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "browser" appears to be invalid.
[3/4] Linking dependencies...
warning "[email protected]" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0".
warning "[email protected]" has unmet peer dependency "react-addons-test-utils@^0.14.0 || ^15.0.0-0".
warning "[email protected]" has incorrect peer dependency "@kadira/storybook@^1.35.1".
[4/4] Building fresh packages...
success Saved lockfile.
$ npm rebuild node-sass
> [email protected] 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
> [email protected] 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
[email protected] /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)
$
In my case it was killed by OOM killer. Increasing RAM from 1GB to 2GB solved the issue.
https://github.com/rails/webpacker/commit/158987a82b605b534bcdc9468efca2602313c791#diff-e36986293b3ec8ccf91a5c317454efcfR20 seems to fix the issue, by abandoning JSON parsing when it failed.
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.
Oh, yes. That is just a fix for error handling.
Maybe this is related:
bash
[...]
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)
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.
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?
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
...
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.
I confirmed it works for me even with v0.24.4.
@nolanlawson Thanks, I will open a separate issue.
Maybe this issue caused by the bug of yarn which is fixed in yarn 0.25.3. I'll check this.
https://github.com/yarnpkg/yarn/issues/2629
Got the same problem with v1.4.1 and it was an OOM issue, solved with some additionnal RAM allocated to my container.
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!
0.25.3 does not work.
I've tested on a machine with 4GB memory + 2GB swap, and the problem is still there.
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.
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?
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'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
> [email protected] 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
> [email protected] 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
[email protected] /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
@bgcarlisle Looks like that's a completely different error: Compiling webpacker assets π, Killed, rails aborted vs sh: /mastodon/node_modules/.bin/webpack: not found
Apologies, still stumped though!
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.
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!
@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.
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...
@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)
@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)!
I woke up and running job in background. Now, I solved that problem. Thank you!
$ 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 ?
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.
In v1.4.4 assets:precompile does not invoke yarn, so this problem seems to be fixed.
I think the problem in the original post is fixed, so closing this issue.
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.
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.
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.
@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.
Most helpful comment
Errrr wait, are you still seeing
sh: /mastodon/node_modules/.bin/webpack: not found? So isyarnjust not able to install at all? Maybe trynpm installinstead ofyarn?