Cannot preview Octopress generated website - ruby

I am new to Jekyll and I am trying to build a blog using static pages with Octopress.
rake is generating the site correctly without any errors but when I try to preview the site, depsite that the server starts without any error
>>> Compass is polling for changes. Press Ctrl-C to Stop.
[2014-02-23 15:23:50] INFO WEBrick 1.3.1
[2014-02-23 15:23:50] INFO ruby 2.0.0 (2013-11-22) [x64-mingw32]
[2014-02-23 15:23:50] INFO WEBrick::HTTPServer#start: pid=1996 port=4000
It will throw errors when I try to access localhost:4000 from my web browser and will not serve the files
127.0.0.1 - - [23/Feb/2014 15:25:25] "GET / HTTP/1.1" 200 - 0.0500
[2014-02-23 15:25:25] ERROR Errno::ECONNRESET: An existing connection was forcibly closed by the remote host.
c:/Ruby/lib/ruby/2.0.0/webrick/httpserver.rb:80:in `eof?'
c:/Ruby/lib/ruby/2.0.0/webrick/httpserver.rb:80:in `run'
c:/Ruby/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
I am running Windows 8.1 and I have been trying rake preview with both Ruby 1.9.3 and 2.0 and also both x86 and x64 architectures on different machines. Also I tried to disable my firewall but it did not fix the issue.
I'd really appreciate some help to solve this issue.
Thanks.

After some googling, it looks like this may be a WEBrick specific error with Windows and IE (you didn't list the browser(s) you tried, but most results also list IE as a culprit). I would try:
Hitting http://localhost:4000 from Firefox/Chrome and see if the error persists
Changing your default web server from WEBrick to something else (I'd recommend the Ruby Thin Server). An easy walkthrough specifically for Octopress and the Thin server can be found at this blog post.

From Octopress documentation, it is recommended that you use Ruby 1.9.3. You can easily get Ruby 1.9.3 and other useful tools for Windows system by installing railsInstaller.

Related

Recurrent invalid byte sequence in UTF-8 with Rails

Environment
Rails 3.2.11
Ruby 1.9.1
utf8-cleaner gem
I am struggling with this issue for over a year now, and I am not able to reproduce it on my dev environment, which makes it rather difficult for me to understand why this is happening and how I can resolve. Here is the error notification I am getting (via email using ExceptionNotifier):
A ArgumentError occurred in home#index:
invalid byte sequence in UTF-8
.bundle/gems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/utils.rb:104:in `normalize_params'
Apparently caused by Chinese spider:
HTTP_USER_AGENT : Mozilla/5.0 (compatible; EasouSpider; +http://www.easou.com/search/spider.html)
I have tried to a couple things, see my earlier question where I was attempting to catch the error.
I have also installer utf8-cleaner gem but that doesn't seem to resolve, unless I missed a step.
How can I reproduce the issue? Note the URL causing the problem is perfectly correct when I access it (?)
UPDATE 20140721 - use rack-utf8_sanitizer
Add gem 'rack-utf8_sanitizer' in Gemfile
Add config.middleware.insert 0, Rack::UTF8Sanitizer in application.rb
$ bundle install
That worked perfectly on DEV but FAILED on my Heroku PRODUCTION, with the following issue:
$ heroku run rake middleware --a test-app
Running `rake middleware` attached to terminal... up, run.4846
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.6
rake aborted!
uninitialized constant Rack::UTF8Sanitizer
/app/config/application.rb:71:in `<class:Application>'
I am still investigating why I should be getting this.
I managed to fix it (on a Rails 3.2.18 app) as described in this gist:
https://gist.github.com/joost/ca4eda8f31655cf6095a
Reproduce the issue caused by
HTTP_USER_AGENT : Mozilla/5.0 (compatible; EasouSpider; +http://www.easou.com/search/spider.html)
Create a ruby script
#!ruby
invalid = "data\xed\xe5\xed\xe0".force_encoding('ASCII-8BIT')
`curl localhost:3000 -d #{invalid}`
Add the rack-utf8_sanitizer gem to your Gemfile
This resolved for my Dev environment, but wouldn't work on Heroku. I updated my question accordingly.
UPDATE:
I added require "rack/utf8_sanitizer" in my application.rb file and that seems to resolve, the Heroku issue.

rake preview generating site without styles

I've set up a vanilla Octopress blog & I am hosting on github pages, but am encountering some issues when using rake preview.
To help troubleshoot, here's a short list of changes I've made since setting up Octopress (that I can recall):
in _config.yml, changed the url to my domain
in _config.yml, changed root to "/"
in _config.yml, specified my github repo under 3rd party settings
added CNAME pointing to my domain in /public/github
added CNAMe pointing to my domain in /source/
made a post using rake new_post
Here's a description of the issues:
http://localhost:4000 yields a 404, however, I am able to see my site at http://localhost:4000/github/index.html
When previewing /github/index.html, most of the stylesheets/JS are returning a 404.
Here's what happens when I run rake generate, followed by rake preview:
Starting to watch source with Jekyll and Compass. Starting Rack on port 4000
Configuration from /Users/[redacted]/Documents/code/octopress/_config.yml
[2013-09-09 10:21:44] INFO WEBrick 1.3.1
[2013-09-09 10:21:44] INFO ruby 1.9.3 (2013-06-27) [x86_64-darwin11.4.2]
[2013-09-09 10:21:44] INFO WEBrick::HTTPServer#start: pid=39870 port=4000
Auto-regenerating enabled: source -> public/github
[2013-09-09 10:21:45] regeneration: 95 files changed
>>> Change detected at 10:21:45 to: screen.scss
identical public/github/stylesheets/screen.css
Dear developers making use of FSSM in your projects,
FSSM is essentially dead at this point. Further development will
be taking place in the new shared guard/listen project. Please
let us know if you need help transitioning! ^_^b
- Travis Tilley
>>> Compass is watching for changes. Press Ctrl-C to Stop.
You need Python 2.x. You should be able to check your Python version at the command prompt with python --version
If you don't have it then if you are on Windows, download and install Python 2.7.6 from http://www.python.org/download/
then add C:\Python27 (or the folder where you installed Python) to your path environment variable.
Did you change the destination setting in _config.yml. Default should be something like this:
root: /
permalink: /blog/:year/:month/:day/:title/
source: source
destination: public

Struggling to boot up WEBrick

First a little indication of what I'm running:
Operating System: Windows 8 64-bit
Ruby version: 1.9.3p362
Rails version: 3.2.11
I've created a new rails project called simple_cms under C:\Users\Dean\Documents\Ruby_Projects\ .
I then navigate into the project directory, so my path then is C:\Users\Dean\Documents\Ruby_Projects\simple_cms\
I then run (with my administrator command prompt)
rails server
but I then get a whole lot of errors but the most prominent one being:
The specified module could not be found some\path\mysql2\1.9\mysql2.so
Any ideas?
EDIT: Attached is my full command prompt output...
It looks like your mysql2 gem hasn't been installed correctly.
Check out the answer to this question for info on properly installing the mysql2 gem. That should take care of the rest of your errors.

Issue in uploading gem to Geminabox

I stood up a Rack server with Geminabox, running on my machine at http://localhost:9292. Now I was trying to upload the gem to the server (from a different tab on the terminal acting like a client), but when I type:
gem sources -a http://localhost:9292
I get the following error:
Error fetching http://localhost:9292:
bad response Not Found 404 (http://localhost:9292/specs.4.8.gz)
There is a trailing colon and I'm a bit lost, any help on that?
Thanks!
You need to upload at least one gem before Geminabox starts to serve the necessary files.
(I know this is an old question but I came here from google so others might as well)

How can I get past "http://gems.rubyforge.org/ does not appear to be a repository" error message

Question 828421 asked similar question, but received only one real answer (update rubygems) and that attempt results in the same error.
Ruby version 1.9.1.p243 on Windows. Included Gem, version 1.3.5.
Never installed any gems before; never did any special config for this Ruby.
Ruby itself works, as does irb, and "gem" operates but can't do install (and maybe other ops).
Tried this (from a book):
gem install rspec
Got this:
ERROR: http://gems.rubyforge.org/ does
not appear to be a repository
ERROR: While executing gem ...
(Gem::RemoteFetcher::FetchError)
SocketError: getaddrinfo: The storage control blocks were destroyed.
(http://gems.rubyforge.org/yaml)
When I go to that URL (without "yaml") using MSIE7, I get a page titled "Gemcutter | awesome gem hosting" and have no problem wandering around that site. So I don't -think- it's a proxy problem (though this is all from inside corporate firewall/proxies/etc).
When I go to that URL -with- "yaml", it goes to "http://production.s3.rubygems.org/yaml" and shows what I assume is an update specification page, starting with this:
--- !ruby/object:Gem::SourceIndex
I didn't destroy any "storage control blocks". So what is preventing gem from installing a gem?
Web search shows MANY people having this same problem over a long span of time, but I have yet to see anyone say "It's because of THIS, so do THIS to fix it." Well, someone suggested updating "gem", but trying that gets same error.
Help please?
Your browser might be using system-wide proxy settings or some sort of automatic configuration. The gem command probably doesn't. I'm behind an university proxy and I can't install/update any gems normally, but can access everything with my browser. To install gems, I normally create a tunnel to my server so I can bypass the proxy server.
This might help you to configure the proxy settings for the gem command: How do I update Ruby Gems from behind a Proxy (ISA-NTLM)
Sample:
sudo gem install nifty-generators -p http://proxy:port
It works well.
If your proxy requires authentication, then use:
gem install --http-proxy http://USERNAME:PASS#HOST:PORT gem_name
This can "at times" mean that for some reason rubygems.org is down currently, and so your local "invisible proxy" is returning you a 404 or what not.
#Tomas Markauskas didn't work for me because i'm not behind a proxy. And I didn't find a solution anywhere, I tried disable my AV and firewall, didn't
This was the solution for me:
gem install rails -r -w -p
Hope this will help people with the same problem.
EDIT: I have Windows 7 64bit.

Resources