webpacker: asset_compile fails during yarn install
We are using beanstalk
as our server. When deploying the logs, we get the following
[1/4] Resolving packages...
Webpacker is installed 🎉 🍰
Using /var/app/ondeck/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:
./bin/webpack:26:in `exec': No such file or directory - /var/app/ondeck/node_modules/.bin/webpack (Errno::ENOENT)
from ./bin/webpack:26:in `block in <main>'
from ./bin/webpack:25:in `chdir'
from ./bin/webpack:25:in `<main>'
(Executor::NonZeroExitStatus)
It appears there is an error installing yarn packages as it is not going to step 2 or 4.
When I ssh into the server, go to the ondeck
directory, which has the newest code I believe and then I run yarn install
, I get:
error An unexpected error occurred: "EACCES: permission denied, mkdir '/var/app/ondeck/node_modules'".```
when I use `sudo yarn install` it works and when I update the permissions with `sudo chmod -R 777 /var/app`, it works. So I tried and add the chmod command to a `.ebextensions config file` but I am having no luck.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 16 (5 by maintainers)
Commits related to this issue
- There is a bug in the current version of the webpacker Gem that interferes with our capistrano deployment. See: https://github.com/rails/webpacker/issues/810 This adds a rake task which overrides th... — committed to curationexperts/laevigata by little9 6 years ago
- There is a bug in the current version of the webpacker Gem that interferes with our capistrano deployment. See: https://github.com/rails/webpacker/issues/810 This adds a rake task which overrides th... — committed to curationexperts/laevigata by little9 6 years ago
- There is a bug in the current version of the webpacker Gem that interferes with our capistrano deployment. See: https://github.com/rails/webpacker/issues/810 This adds a rake task which overrides th... — committed to curationexperts/laevigata by little9 6 years ago
- There is a bug in the current version of the webpacker Gem that interferes with our capistrano deployment. See: https://github.com/rails/webpacker/issues/810 This adds a rake task which overrides th... — committed to little9/laevigata by little9 6 years ago
- Trying to fix the yarn install issue. This follows https://github.com/rails/webpacker/issues/810 — committed to an-ju/projectscope by an-ju 6 years ago
@kolosek may the universe bless your existence. After a seemingly endless amount of turmoil I finally have assets precompiling on EB! Praise the Lord!
Hi, not sure if this is related but I ran into a similar issue (same logs “No such file or directory node_modules/.bin/webpack (Errno::ENOENT)”) on a project that I updated from Rails 4.2 to Rails 5.2.
After digging, here is what was happening:
rake assets:precompile
runs a hook to install yarn packages. If the taskyarn:install
exists, it will use it, otherwise it will usewebpacker:yarn_install
. See https://github.com/rails/webpacker/blob/d8dd4460144e63a9120290631c492aba3cbea332/lib/tasks/webpacker/compile.rake#L13 Since I’m using Rails 5.2yarn:install
was existing.yarn:install
is defined somewhere in railties and usesbin/webpack
. In my case this file wasn’t existing since I updated from Rails 4.2. So this was failing silently (maybe it shouldn’t?).After adding the
bin/yarn
file (copied from a Rails 5 project), it worked!@antoinematyja Your solution worked. For the sake of other developers, here is the content of yarn file that worked for me, by placing it in /bin filder.
@foton You would need to run
yarn
oryarn install
likebundle
after cloning sincenode_modules
are ignored. No need to runwebpacker:yarn_install
, it’s same thing.@mlennie You need to make sure
./bin/webpack
binstub is checked into your source control. This file is generate when you runbundle exec rails webpacker:install