shakacode / react_on_rails

Integration of React + Webpack + Rails + rails/webpacker including server-side rendering of React, enabling a better developer experience and faster client performance.
https://www.shakacode.com/react-on-rails/docs/
MIT License
5.11k stars 630 forks source link

NO ISSUE: Possible deploy issue after i18n changes in 6.7.1 #746

Closed justin808 closed 7 years ago

justin808 commented 7 years ago

Please revert to 6.6.0 if you run into this...

This will be fixed this evening.

justin808 commented 7 years ago

https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/16 is a newly generated app.

It deploys to heroku just fine: https://react-on-rails-redux-generator.herokuapp.com/

justin808 commented 7 years ago

The cause of the issue was due to an invalid value in config/react_on_rails.rb

  config.i18n_dir = Rails.root.join("client", "app", "libs", "i18n")

The above directory did not exist!

justin808 commented 7 years ago

The deploy error was:

Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/build_1444a5bb9dd16ddb2561c7aff40f0fc7/some-app-816d31e9896edd90cecf1402acd002c724269333/client/app/libs/i18n/translations.js
amf9t2 commented 7 years ago

@justin808 I am getting the same error while deployment 'Error configuring /config/react_on_rails.rb: invalid value for config.i18n_dir. Directory does not exist:'

After changing to 6.6.0 I get the below error

**bundle exec rake react_on_rails:locale**
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.3-compliant syntax, but you are running 2.3.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
rake aborted!
**Don't know how to build task 'react_on_rails:locale' (see --tasks)**
/var/lib/jenkins/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/var/lib/jenkins/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
rake aborted!
**Command failed with status (1): [bundle exec rake react_on_rails:locale...]**

Does this mean we cannot use react_on_rails i18n setup with version 6.6.0 setup ?

justin808 commented 7 years ago

@amf9t2 Please update to current 6.9.3 and let me know if you still see issues.

trungnguyencmu commented 7 years ago

I still see issues at 6.9.3 version

rake aborted! Error configuring /config/react_on_rails.rb: invalid value for config.i18n_dir. Directory does not exist: /var/www/scry/tmp/build-149161890412039/client/app/libs/i18n. Set to value to nil or comment it out if not using this i18n with React on Rails. /var/www/scry/tmp/build-149161890412039/vendor/bundle/ruby/2.3.0/gems/react_on_rails-6.9.3/lib/react_on_rails/configuration.rb:23:in check_i18n_directory_exists' /var/www/scry/tmp/build-149161890412039/vendor/bundle/ruby/2.3.0/gems/react_on_rails-6.9.3/lib/react_on_rails/configuration.rb:15:insetup_config_values' /var/www/scry/tmp/build-149161890412039/vendor/bundle/ruby/2.3.0/gems/react_on_rails-6.9.3/lib/react_on_rails/configuration.rb:4:in configure' /var/www/scry/tmp/build-149161890412039/config/initializers/react_on_rails.rb:2:in<top (required)>

justin808 commented 7 years ago

@trungnguyencmu and @amf9t2 Please change the value you have set in your react_on_rails.rb file: config.i18n_dir

That's all you have to do.

trungnguyencmu commented 7 years ago

@justin808 Your mean, delete this line config.i18n_dir = Rails.root.join("client", "app", "libs", "i18n").

justin808 commented 7 years ago

Delete or set it to nil.

trungnguyencmu commented 7 years ago

if don't set it, It will not generate when deploy, And announce error because can't find libs/i18n/translations

justin808 commented 7 years ago

@trungnguyencmu If you can give this a better error message, that would be great!

trungnguyencmu commented 7 years ago

screenshot 2017-04-09 18 38 52

My error that I got 🗡 thanks @justin808

justin808 commented 7 years ago

@trungnguyencmu my eyes bleed from so many double dots.

Use a webpack path alias so you don't have to do that!

trungnguyencmu commented 7 years ago

I have added alias, It's still run fine on my local. But I still got error when deploy screenshot 2017-04-10 13 04 55. If I delete config.i18n_dir = Rails.root.join("client", "app", "libs", "i18n"), how to system generate translations.js or default.js to libs/i18n

justin808 commented 7 years ago

your error now is related to your production setup

trungnguyencmu commented 7 years ago

Thanks @justin808

phanhaiquang commented 7 years ago

I fixed this issue by creating client/app/libs/i18n folder and commit it to repo (by creating .keep file inside and add it to repo). It seems that this folder is not auto created at production. I am using version 6.7.1

amf9t2 commented 7 years ago

@phanhaiquang I guess this is the only way around for this problem. @justin808 if we delete the configuration or make it null then how we will generate the translations file. Do you mean remove it after generating the translations file (assets)?

justin808 commented 7 years ago

@amf9t2:

if we delete the configuration or make it null then how we will generate the translations file. Do you mean remove it after generating the translations file (assets)?

If you're using i18n, then you want the configuration. Please open a new ticket to focus on your specific issue.

amf9t2 commented 7 years ago

Created new issue - https://github.com/shakacode/react_on_rails/issues/818 Thanks.