Webpacker: No such file public/packs/manifest.json

Created on 30 May 2017  Β·  10Comments  Β·  Source: rails/webpacker

When deploying my rails 5.1 app I am occasionally getting this error:

Errno::ENOENT: No such file or directory @ rb_sysopen - /var/www/app/releases/20170530002953/public/packs/manifest.json
/var/www/app/shared/bundle/ruby/2.4.0/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:17:in `read'
/var/www/app/shared/bundle/ruby/2.4.0/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:17:in `block (2 levels) in <top (required)>'
/var/www/app/shared/bundle/ruby/2.4.0/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:34:in `block in <top (required)>'
/var/www/app/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/opt/ruby-2.4/bin/bundle:22:in `load'
/opt/ruby-2.4/bin/bundle:22:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

I am deploying with capistrano.

It fails on one server but not on the other.

They both have the same versions of nodejs and yarn.
node --version v6.9.1
yarn install v0.24.5

Is there any more information I can provide to help with working out this issue?

Full deploy output: https://gist.github.com/TigerWolf/5aa2bc006912de5539b518dc1bd9e984

Most helpful comment

To anyone else that is hitting this I was getting this from a brand new rails app

$ rails new zoomba
$ cd zoomba/
$ subl . # add `gem 'webpacker'` to project
$ bundle install
$ bundle exec rails webpacker:install
$ RAILS_ENV=production bin/rails  assets:precompile
yarn install v1.6.0
[1/4] πŸ”  Resolving packages...
success Already up-to-date.
✨  Done in 0.62s.
Webpacker is installed πŸŽ‰ 🍰
Using /private/tmp/zoomba/config/webpacker.yml file for setting up webpack paths
[Webpacker] Compiling assets πŸŽ‰
[Webpacker] Compiled digests for all packs in /private/tmp/zoomba/app/javascript/packs:
rails aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /private/tmp/zoomba/public/packs/manifest.json
/Users/rschneeman/.gem/ruby/2.5.1/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:17:in `read'
/Users/rschneeman/.gem/ruby/2.5.1/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:17:in `block (2 levels) in <main>'
/Users/rschneeman/.gem/ruby/2.5.1/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:34:in `block in <main>'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/command.rb:48:in `invoke'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/Users/rschneeman/.gem/ruby/2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
/Users/rschneeman/.gem/ruby/2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
/Users/rschneeman/.gem/ruby/2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
bin/rails:9:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

Upgrading to 3.5.2 fixed it

Using webpacker 3.5.2 (was 2.0)
Bundle updated!
β›„  2.5.1 πŸš€  /tmp/zoomba (master)
$ RAILS_ENV=production bin/rails  assets:precompile
yarn install v1.6.0
[1/4] πŸ”  Resolving packages...
success Already up-to-date.
✨  Done in 0.66s.
Webpacker is installed πŸŽ‰ 🍰
Using /private/tmp/zoomba/config/webpacker.yml file for setting up webpack paths
Compiling…
Compiled all packs in /private/tmp/zoomba/public/packs

All 10 comments

Hey, what settings you have in webpacker.yml? Looking at logs, it seems both output and source is same - so it's not writing the packs in public/packs

Upon further investigation: It looks like the job before it is being killed for taking too long on that server due to other processes. This also happens when running the rake task on the console not just from capistrano. Does rails/webpacker/yarn have a timeout of 4 minutes?

Will close this issue as likely its not webpacker related.

I have the same issue.
Here is the output:

 ./bin/rails webpacker:compile                                                                                                                                          [2.4.0]
Webpacker is installed πŸŽ‰ 🍰
Using /Users/Matthias/code/MatthiasRMS/my_app/config/webpacker.yml file for setting up webpack paths
[Webpacker] Compiling assets πŸŽ‰
[Webpacker] Compiled digests for all packs in /Users/Matthias/code/MatthiasRMS/my_app/app/javascript/packs:
rails aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/Matthias/code/MatthiasRMS/my_app/public/packs/manifest.json
/Users/Matthias/code/MatthiasRMS/my_app/bin/rails:10:in `require'
/Users/Matthias/code/MatthiasRMS/my_app/bin/rails:10:in `<top (required)>'
/Users/Matthias/code/MatthiasRMS/my_app/bin/spring:15:in `<top (required)>'
./bin/rails:4:in `load'
./bin/rails:4:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

Any idea @gauravtiwari ? Thanks

I also couldn't find public/packs/manifest.json on production.
Who generates this file? On development, bin/webpack-dev-server generates it, but rails webpacker:compile doesn't.

$ RAILS_ENV=production bundle exec rails webpacker:compile
Webpacker is installed πŸŽ‰ 🍰
Using /var/www/xxx/config/webpacker.yml file for setting up webpack paths
[Webpacker] Compiling assets πŸŽ‰
[Webpacker] Compiled digests for all packs in /var/www/xxx/app/javascript/packs:
rails aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /var/www/xxx/public/packs/manifest.json
bin/rails:9:in `require'
bin/rails:9:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

@kami-zh Is it possible that your issue is related? https://github.com/rails/webpacker/issues/444#issuecomment-304805472

It looks like the job before it is being killed for taking too long on that server due to other processes.

@gauravtiwari Thank you for your reply!
When I tried to execute RAILS_ENV=production bin/webpack, and got following error:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]

And I've solved this issue according to https://github.com/webpack/webpack/issues/1914#issuecomment-303837359 which relates to being out of memory.

This fixes requested on https://github.com/rails/webpacker/pull/417 , but it closed.
I think what should I do is moving all of my JavaScript files without entrypoints from app/javascript/packs to other directory such as app/assets/javascripts.

@kami-zh Great πŸ‘

Yes only entries needs to live under packs and everything else should be under app/javascript otherwise you might get into circular dependency problem.

I had this line for my production compile, which generates sourcemaps.

    new webpack.optimize.UglifyJsPlugin({
      minimize: true,
      sourceMap: true,

I set to sourceMap: false and the error missing manifest.json was gone.

I am thinking v3.5.4 https://github.com/webpack/webpack which is currently using v0.4.6 https://github.com/webpack-contrib/uglifyjs-webpack-plugin is causing this problem..

To anyone else that is hitting this I was getting this from a brand new rails app

$ rails new zoomba
$ cd zoomba/
$ subl . # add `gem 'webpacker'` to project
$ bundle install
$ bundle exec rails webpacker:install
$ RAILS_ENV=production bin/rails  assets:precompile
yarn install v1.6.0
[1/4] πŸ”  Resolving packages...
success Already up-to-date.
✨  Done in 0.62s.
Webpacker is installed πŸŽ‰ 🍰
Using /private/tmp/zoomba/config/webpacker.yml file for setting up webpack paths
[Webpacker] Compiling assets πŸŽ‰
[Webpacker] Compiled digests for all packs in /private/tmp/zoomba/app/javascript/packs:
rails aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /private/tmp/zoomba/public/packs/manifest.json
/Users/rschneeman/.gem/ruby/2.5.1/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:17:in `read'
/Users/rschneeman/.gem/ruby/2.5.1/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:17:in `block (2 levels) in <main>'
/Users/rschneeman/.gem/ruby/2.5.1/gems/webpacker-2.0/lib/tasks/webpacker/compile.rake:34:in `block in <main>'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/command.rb:48:in `invoke'
/Users/rschneeman/.gem/ruby/2.5.1/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/Users/rschneeman/.gem/ruby/2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/Users/rschneeman/.gem/ruby/2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
/Users/rschneeman/.gem/ruby/2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
/Users/rschneeman/.gem/ruby/2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
bin/rails:9:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

Upgrading to 3.5.2 fixed it

Using webpacker 3.5.2 (was 2.0)
Bundle updated!
β›„  2.5.1 πŸš€  /tmp/zoomba (master)
$ RAILS_ENV=production bin/rails  assets:precompile
yarn install v1.6.0
[1/4] πŸ”  Resolving packages...
success Already up-to-date.
✨  Done in 0.66s.
Webpacker is installed πŸŽ‰ 🍰
Using /private/tmp/zoomba/config/webpacker.yml file for setting up webpack paths
Compiling…
Compiled all packs in /private/tmp/zoomba/public/packs

+1

Was this page helpful?
0 / 5 - 0 ratings