Comments (16)
Hi,
I'm having a similar with file I want to be precompiled. I put my button.js.jsx in assets/javascripts/components/common/button.js.jsx
and in our bundle file I require it like that:
//= require components/common/button.js.jsx
In my development.rb I have:
config.react.variant = :development
config.react.addons = true
We are using Rails 4.2.5.2 and react-rails 1.6.2 with ruby 2.3.0p0
When I reload the page I got the following error:
couldn't find file 'components/common/button.js.jsx' with type 'application/javascript'
Any help is welcoming, actually we are processing the file with gulp and it will be a great improvement if we can use the assets pipelines for it.
Thanks a lot for helping.
from react-rails.
I'll look into it tomorrow, thanks for reporting.
from react-rails.
I tried to duplicate your stack as precisely as I could to no avail yet.
Would you mind if I asked you to prepare a repro case?
from react-rails.
Our team just upgraded to Rails 4 and this now works. I don’t have much time to dig into this right now unfortunately. It sounds like I’m the only person running into this, so you can just close this as a wontfix. Thanks for looking into this!
from react-rails.
Hi, we are supporting rails 3.2! Could you maybe post your Gemfile.lock
if it's not secret? (The one from when the problem occurred)
from react-rails.
Here's the Gemfile.lock
from before our Rails 4 port: https://gist.github.com/steadicat/958186cbb9abae280411 Hope it helps!
from react-rails.
I completely missed #23, but it looks likely to be the same issue and has a solution.
from react-rails.
I'm using ruby-2.1.1 with rails-3.2.17 and this script reproduces the problem for me:
#!/bin/sh
rails _3.2.17_ new rtest
cd rtest
echo 'gem "react-rails", "~> 0.9.0.0"' >> Gemfile
bundle install
echo "//= require react" >> app/assets/javascripts/application.js
rake assets:precompile --trace
adding
config.assets.initialize_on_precompile = true
doesn't seem to make a difference
from react-rails.
@acrispino thanks for the report! It is just because you didn't set the variant, in 1.0.x
we'll default to a variant based on an environment, but in 0.x
you need to set it explicitly in config/environments/production|development.rb
:
config.react.variant = :development
or :production
appropriately.
I can't reproduce @steadicat's issue though.
from react-rails.
We'll reopen if someone runs into this in the future.
from react-rails.
@JakubMal, we are running in to the exact same issue that @steadicat reported.
We are using Rails 3.2.13 and ruby 1.9.3p194.
Full output of rake assets:precompile
$ RAILS_ENV=production rake assets:precompile --trace
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.9.0
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/rutul/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.9.0
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
couldn't find file 'react'
(in /Users/rutul/BrightFunds/brightfunds/app/assets/javascripts/application.js:1)
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/context.rb:102:in `resolve'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/context.rb:142:in `require_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:215:in `process_require_directive'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:165:in `block in process_directives'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:163:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:163:in `process_directives'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:97:in `evaluate'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/tilt-1.3.7/lib/tilt/template.rb:77:in `render'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `new'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `block in build_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:270:in `circular_call_protection'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:248:in `build_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:16:in `initialize'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:19:in `block in compile'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_precompile'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/Users/rutul/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/Users/rutul/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/bin/rake:19:in `load'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/rutul/.rvm/rubies/ruby-1.9.3-p194/b...]
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `call'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `sh'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `sh'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/file_utils.rb:80:in `ruby'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `ruby'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/Users/rutul/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/bin/rake:19:in `load'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/bin/rake:19:in `<main>'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/bin/ruby_noexec_wrapper:14:in `eval'
/Users/rutul/.rvm/gems/ruby-1.9.3-p194@brightfundsv2/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile
from react-rails.
@stockandawe are you sure you have config.react.variant = :development
or :production
in environment?
from react-rails.
@JakubMal, I have config.react.variant = :production
in config/environments/production.rb and config.react.variant = :development
in config/environments/development.rb
from react-rails.
I have the exact same issue. I'm using 0.9 and I have specified variant in both development.rb and production.rb (https://gitorious.org/gitorious/mainline/source/596c64564bfb4cb13ab5cdfccd4c585e3de58732:config/environments/production.rb#L65). Rails 3.2.16.
from react-rails.
I know this issue is closed but am having a similar issue as @Migoo
from react-rails.
In general, shouldn't you require without file extension? eg
//= require components/common/button
Does that work any better? Or does it raise a different error? Also, could you report your sprockets version? It seems like we're still tracking down compatibility issues with Sprockets 3
from react-rails.
Related Issues (20)
- Can't resolve 'react-dom/client' HOT 3
- Import react_component but it' shown HOT 2
- compare/contrast and migration steps to react_on_rails HOT 5
- Component doesn't render on jsbundling-rails webpacker HOT 5
- Component not loading in rails app HOT 5
- react-rails v3.1.0 is broken HOT 1
- server_rendering.js not found following README HOT 8
- Re-organize documentations in docs folder
- server_rendering.js not found following README HOT 1
- How do I handle styling?
- esbuild HOT 1
- Error related to server_rendering.js not found with SSR HOT 3
- Setup StrictMode for components HOT 2
- get started docs r-r version HOT 1
- Rails 7.1 Renders Partial Header HOT 1
- Server side rendering `window` behaves differently than Node.js? HOT 4
- Issues with Loading React Component for Cuprite in Rails 7.1
- Hooks not working due to Invalid Hook Call HOT 2
- Move react_ujs to es module flow
- Error when use React component other than HelloWorld
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-rails.