Webpacker configuration file not found - Rails 6.0.0
I was trying to run "rails s" to run my server then I suddenly run into an error that says webpacker configuration not found.
Here's the info:
boot@noki-K54C:~/Desktop/app$ rails s
=> Booting Puma
=> Rails 6.0.0 application starting in development
=> Run `rails server --help` for more startup options
RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
Exiting
<b>Traceback</b> (most recent call last):
79: from bin/rails:3:in `<main>'
78: from bin/rails:3:in `load'
77: from /home/app/Desktop/jonabell/bin/spring:15:in `<top (required)>'
76: from /home/app/Desktop/jonabell/bin/spring:15:in `require'
75: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
74: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
73: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
72: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
71: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
70: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
69: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
68: from /home/app/Desktop/jonabell/bin/rails:9:in `<top (required)>'
67: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
66: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
65: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
64: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
63: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
62: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
61: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
60: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
59: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
58: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
57: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
56: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
55: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
54: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
53: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform'
52: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap'
51: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
50: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:37:in `start'
49: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
48: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:354:in `wrapped_app'
47: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:219:in `app'
46: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:319:in `build_app_and_options_from_config'
45: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file'
44: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string'
43: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval'
42: from config.ru:in `<main>'
41: from config.ru:in `new'
40: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize'
39: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval'
38: from config.ru:3:in `block in <main>'
37: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
36: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
35: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
34: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
33: from /home/app/.rvm/gems/ruby-2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require'
32: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
31: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
30: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
29: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
28: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
27: from /home/app/Desktop/jonabell/config/environment.rb:5:in `<main>'
26: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
25: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
24: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
23: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
22: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
21: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `call'
20: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each'
19: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
18: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
17: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
16: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
15: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
14: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
13: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
12: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:84:in `block in <class:Engine>'
11: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `bootstrap'
10: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/commands.rb:14:in `bootstrap'
9: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:18:in `refresh'
8: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:83:in `load'
7: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:47:in `public_manifest_path'
6: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:43:in `public_output_path'
5: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:39:in `public_path'
4: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:80:in `fetch'
3: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:84:in `data'
2: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `load'
1: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `read'
/home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `read': <b>No such file or directory @ rb_sysopen - /home/app/Desktop/jonabell/config/webpacker.yml (</b><u style="text-decoration-style:single"><b>Errno::ENOENT</b></u><b>)</b>
78: from bin/rails:3:in `<main>'
77: from bin/rails:3:in `load'
76: from /home/app/Desktop/jonabell/bin/spring:15:in `<top (required)>'
75: from /home/app/Desktop/jonabell/bin/spring:15:in `require'
74: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
73: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
72: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
71: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
70: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
69: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
68: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
67: from /home/app/Desktop/jonabell/bin/rails:9:in `<top (required)>'
66: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
65: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
64: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
63: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
62: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
61: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
60: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
59: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
58: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
57: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
56: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
55: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
54: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
53: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
52: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform'
51: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap'
50: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
49: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:37:in `start'
48: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
47: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:354:in `wrapped_app'
46: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:219:in `app'
45: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:319:in `build_app_and_options_from_config'
44: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file'
43: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string'
42: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval'
41: from config.ru:in `<main>'
40: from config.ru:in `new'
39: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize'
38: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval'
37: from config.ru:3:in `block in <main>'
36: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
35: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
34: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
33: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
32: from /home/app/.rvm/gems/ruby-2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require'
31: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
30: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
29: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
28: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
27: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
26: from /home/app/Desktop/jonabell/config/environment.rb:5:in `<main>'
25: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
24: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
23: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
22: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
21: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
20: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `call'
19: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each'
18: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
17: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
16: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
14: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
13: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
12: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
11: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:84:in `block in <class:Engine>'
10: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `bootstrap'
9: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/commands.rb:14:in `bootstrap'
8: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:18:in `refresh'
7: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:83:in `load'
6: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:47:in `public_manifest_path'
5: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:43:in `public_output_path'
4: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:39:in `public_path'
3: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:80:in `fetch'
2: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:84:in `data'
1: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:87:in `load'
/home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:91:in `rescue in load': <b>Webpacker configuration file not found /home/app/Desktop/jonabell/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /home/app/Desktop/jonabell/config/webpacker.yml (</b><u style="text-decoration-style:single"><b>RuntimeError</b></u><b>)</b>
boot@noki-K54C:~/Desktop/app$
I already check the version of rails and its 6.0.0 my ruby version is 2.6.0.
Tried to search the web and try a few solutions but did not work out for me.
Any idea what am I missing?
Solution 1:
Since Rails 6, Webpacker is the default JavaScript compiler. So you'll also have to set it up before starting your Rails server.
- Install
yarn
using your OS package manager, or take a look at https://yarnpkg.com/en/docs/install - Set it up
rails webpacker:install
- Make sure all packages are up to date
yarn install --check-files
- Start your Rails server
rails s
Enjoy!
Solution 2:
To add onto what has been said, make sure to check the error message for instructions on how to go about resolving the issue. In this case the error says:
..."Please run rails webpacker:install"...
Once you run rails webpacker:install
you'll see the error that you don't have yarn installed, in which case you can go to the Installation Instructions to figure out how to install yarn for your operating system. For unix (I'm on a unix Amazon Cloud9 environment) I had to run:
curl -o- -L https://yarnpkg.com/install.sh | bash
Then I was able to successfully run rails webpacker:install
and then once I ran rails server
I saw the error:
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
After that was installed, rails s
worked just fine.
I hope that gives more insight into how to go about "debugging" the issue!
Solution 3:
After installing Rails, and setting up new application, once i tried to run rails server
, i faced this error.
I checked config/
and webpack configuration file was missing.
Following way i could fix it and made it working 100%.
Go to root directory of your rails application and follow instruction below.
Install webpacker
bundle exec rails webpacker:install
command.
Conditionally
-
If your system doesn't have nodejs, you need to install
nodejs
from https://nodejs.org/en/download/ -
Once Nodejs is installed, it might throw another error,
yarn not installed
in that case, Run command
npm install --global yarn
and after sorting all above, i was able to run rails server
and thus working.
Above command was performed in MacOS Mojave, Please check corresponding OS command to install both node/yarn before proceeding.
To see complete installation and running instruction you can check: https://medium.com/intelligent-computing/up-and-running-your-first-ruby-on-rails-app-with-troubleshooting-83e694d87605