I cloned a sinatra app https://github.com/trivektor/Backbone-Hangman with a file set up like you see in the image below. In the terminal, I ran the ruby hangman.rb commandbut I got the error
`require': no such file to load -- sinatra/static_assets
Would static_assets refer to the images and css in the public folder? Is static_assets the sinatra way of including those files? Can anyone explain what might be the problem?
Looks like that example needs the sinatra-static-assets gem.
gem install sinatra-static-assets
fixes the problem.
Related
I'm new to middleman and I'm having big problems when I try to install it on Windows 10. It keeps giving me errors that I can't understand at all. It looks like the cli gem isn't install but it is. I've attached a picture as well.
'require': cannot load such file --dotenv
Try mm-init, mm-build, mm-server
I am learning Middleman. I installed Vagrant and have set up everything about that. But I have a problem at the end, when I call "bundle exec middleman", the Middleman should start after that regularly. But I get this message:
"var/lib/gems/2.2.0/gems/tilt-1.4.1/lib/tilt/template.rb:144:in 'require':cannot load such file -- less (LoadError)"
What should I do? I am working on Linux.
Maybe you forgot to add less to your Gemfile:
gem 'less'
As #tadman has pointed out adding
gem 'less'
is (possibly) a solution, but here is a little more detail on why you might have this problem migrating or developing a site:
If you initialise a middleman project with middleman init, then start working on your site with 'middleman serve' everything should be fine. But if, at some point you add a file with a .less extension you will get this error when you next restart middleman. Note that you might not knowingly have added less files - fontawsome for example can add .less versions of the css deep in it's directory structure.
I say that installing less is only possibly a solution since the 'less' gem was broken when I tried it (it was not able to install due to an old dependency on therubyracer
Deleting .less files that you didn't want or know you had is also a solution.
I'm trying to switch over to PHPStorm and I would like to activate the transpiling of SCSS files, but it seems like one file is missing in my ruby-folder.
I found an image in this thread, which shows how to configure the file watcher:
The problem is now that I don't have a "scss.bat" in my /bin/-folder, to insert in the "Program:"-field. I made sure that I have the latest version of ruby by downloading it from rubyinstaller.org.
These ".bat"-files are in my folder:
erb
gem
irb
rake
rdoc
ri
setrbvars
testrb
I tried every file, but I get a different error each time.
What am I doing wrong?
Thanks for your help.
I found my error:
I forgot to install SCSS after my Ruby-installation. To do so open your commandline and type:
gem install scss
I'm trying to create a rails asset gem whose source is here. The problem is that when I use the gem in try to require or import the asset files in my Rails 4 project, I get the error:
File to import not found or unreadable: jquery.xdan.datetimepicker
I've inspected the paths it is looking through, and it looks like it's not actually looking in the assets directory for my gem (the gem folder isn't anywhere in the list). So, it seems like the gem isn't getting required, since if it was, the Engine would be getting loaded, indicating to Rails that I have an assets folder somewhere. Can anyone see what I'm missing? From what I can tell, I'm doing everything that other asset gems are doing.
I looked at your Gem. In order to get it working, rename lib/xdan_datetimepicker_rails.rb to lib/xdan-datetimepicker-rails.rb.
In your Rails project, uninstall your old gem and install the new one. To make sure it's installed properly:
$ rails c
> pp MyRailsApp::Application.assets.paths
You should see an array of paths that are in the asset pipeline. Look for:
/gem/path/to/xdan-datetimepicker-rails-0.0.1/app/assets/javascripts
/gem/path/to/xdan-datetimepicker-rails-0.0.1/app/assets/stylesheets
NOTE: Restart rails c and/or rails s if you're not seeing it.
Finally, in order to use the assets:
app/assets/javascript/application.js
//= require jquery.xdan.datetimepicker
app/assets/stylesheets/stylesheet.css.scss
*= require jquery.xdan.datetimepicker
I understand that after Ruby 1.9.2, '.' is no longer in your path for security reasons. This seems to be a problem when using certain gems (ones not updated to 1.9 I imagine?), a problem that throws errors like
$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- rubylog (LoadError)
I've seen and fixed this problem once, by (perhaps naively) changing some requires into require_relatives: https://github.com/mathpunk/MongoDB_Koans/commit/e2f7898347d328450ec121d22f701508f389cc53
Now I'd like to use rubylog, and I'm getting the custom_require error, so I tried the same trick:
https://github.com/mathpunk/rubylog/commit/995e13dccc6a197d280d0783f3fb7fe50deabd02
but this time, I'm just getting the same error. What else can I try?
ETA: All this time, I've been using sudo gem install blah to install gems, and for some reason, for rubylog it's gem install rubylog that does it. (Something to do with RVM?) So now everything works. Thank you.
Your code fails at require 'rubylog' - so it can't find rubylog.rb itself. So just add dir containing rubylog.rb to load path - something like $: << 'rubylog' might help.
Just add the library directory to your LOAD_PATH:
$LOAD_PATH.unshift(File.dirname(__FILE__))
See Understanding Ruby's load paths\
Edit: I assumed you had a rubylog directory wherever your script was running from. If your script can't find rubylog then you need to add that location to your load path:
$LOAD_PATH.unshift('/path/to/rubylog')
Are you sure you have the rubylog libraries? gem install rubylog