Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

NoMethodError at /docs/index.html undefined method `force_encoding' for nil:NilClass #3

Closed
jlsuttles opened this issue Jun 27, 2017 · 7 comments
Assignees

Comments

@jlsuttles
Copy link
Contributor

I ran make website, visited http://localhost:4567, and clicked on the "Docs" link.

screen shot 2017-06-27 at 11 03 37 am

NoMethodError: undefined method `force_encoding' for nil:NilClass
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:289:in `ensure in binary'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:289:in `binary'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:279:in `extract_magic_comment'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:275:in `extract_encoding'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:191:in `precompiled'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/erb.rb:57:in `precompiled'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/erb.rb:104:in `precompiled'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:245:in `compile_template_method'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:240:in `compiled_method'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:169:in `evaluate'
	/usr/local/bundle/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/core_extensions/rendering.rb:313:in `render_individual_file'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/core_extensions/rendering.rb:153:in `render_template'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/sitemap/resource.rb:127:in `block in render'
	/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/notifications.rb:166:in `instrument'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/util.rb:41:in `instrument'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/application.rb:244:in `instrument'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/sitemap/resource.rb:14:in `instrument'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/sitemap/resource.rb:100:in `render'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/core_extensions/request.rb:260:in `process_request'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/core_extensions/request.rb:210:in `block in call!'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/core_extensions/request.rb:209:in `catch'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/core_extensions/request.rb:209:in `call!'
	/usr/local/bundle/gems/middleman-core-3.4.1/lib/middleman-core/core_extensions/request.rb:195:in `call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/urlmap.rb:66:in `block in call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/urlmap.rb:50:in `each'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/urlmap.rb:50:in `call'
	/usr/local/bundle/gems/rack-livereload-0.3.16/lib/rack/livereload.rb:23:in `_call'
	/usr/local/bundle/gems/rack-livereload-0.3.16/lib/rack/livereload.rb:14:in `call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/showexceptions.rb:24:in `call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/head.rb:13:in `call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/lint.rb:49:in `_call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/lint.rb:37:in `call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/builder.rb:153:in `call'
	/usr/local/bundle/gems/rack-1.6.8/lib/rack/handler/webrick.rb:88:in `service'
	/usr/local/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
	/usr/local/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
	/usr/local/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
@apparentlymart
Copy link
Contributor

Sorry this isn't working properly, @jlsuttles 😕

This looks like the same problem being discussed in middleman/middleman#1536. If I'm understanding correctly, this was eventually blamed on some issues with case-insensitive filenames on Mac OS, but since we have all the same filenames we had before and indeed the symptoms are slightly different here I think a similar but different problem applies here.

Are you using Docker for Mac there? The big difference between this new website setup and the old is that it uses symlinks to connect the docs from the various repository submodules, so my guess is that the extra osxfs layer that is used for volumes on OS X is having some trouble with how the symlinks are set up.

Unfortunately I don't have a Mac handy to try this on right now but I'll see if I can get hold of one tomorrow to try to repro this and dig in some more.

In the mean time, it might work to run make build to produce a static copy of the website in the subdir build, or assuming you're working on TFE docs you can probably access directly the URL http://127.0.0.1:4567/docs/enterprise/index.html, which (if my theory is correct) should work correctly since no symlinks need to be traversed to deal with this part of the site.

@jlsuttles
Copy link
Contributor Author

@apparentlymart Thanks for looking into this! I am using Docker for Mac. It is not blocking me, so I will close the issue. I just wanted to make sure it wasn't going to be an issue when deploying the docs!

@vancluever
Copy link
Contributor

Just FYI - this is something very similar to what I've been running into as well on my Linux box. If it isn't fixed by that time I will dive in after I'm done with an AWS provider PR I've been working on!

@apparentlymart
Copy link
Contributor

Thanks @vancluever. @grubernaut also reproed on Linux earlier, so seems like my theory was wrong. I'm trying to get a repro on my machine here.

@gberche-orange
Copy link

@vancluever @apparentlymart I'm reproducing on a Linux box (running in a virtual box), as part of cloudfoundry-community/terraform-provider-cloudfoundry#142 (comment)

Not sure if this could be related but in http://127.0.0.1:4567/__middleman/config/ I have

:encoding = "utf-8"
Default string encoding for templates and output

@imjoey
Copy link

imjoey commented Sep 29, 2018

hi @apparentlymart , I also encountered the same issue on my local Docker for Mac when accessing /docs/index.html of the terraform provider for oVirt 1.

@andrzejressel
Copy link

andrzejressel commented May 27, 2020

I have it on /downloads.html on Hyper-V'd Ubuntu 20.04

mwickett pushed a commit that referenced this issue Feb 23, 2023
alexcarpenter added a commit that referenced this issue Mar 13, 2023
* fix merge conflict

* get basic client side w/ context working

* try to add analytics event

* cleanup from other middleware based approach

* add loading implementation to avoid layout thrash

* move to min width approach

* install @hashicorp/react-standalone-link

* fix images

* implements result track calls

* import React

* fix casing

* fix button theme

* convert to min width approach

* simplify setup

* bump to latest subnav

* remove index

---------

Co-authored-by: Alex Carpenter <im.alexcarpenter@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants