New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid prefix (does not start with a slash): "/default.haml" #873

Closed
jm3 opened this Issue Jun 22, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@jm3

jm3 commented Jun 22, 2016

I'm trying to upgrade my Nanoc3 app to Nanoc4, but nanoc thinks that the prefix /default.haml doesn't begin with a / …? not sure what the app expects developers to do with this error.

full log:

Crashlog created at 2016-06-22 12:18:58 -0700

===== MESSAGE:

Nanoc::Identifier::InvalidPrefixError: Invalid prefix (does not start with a slash): "/default.haml"

===== COMPILATION STACK:

  (empty)

===== STACK TRACE:

   0. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/entities/identifier.rb:126:in `prefix'
   1. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:35:in `block (3 levels) in site_from_config'
   2. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:35:in `each'
   3. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:35:in `block (2 levels) in site_from_config'
   4. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:30:in `each'
   5. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:30:in `block in site_from_config'
   6. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:55:in `with_data_sources'
   7. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:29:in `site_from_config'
   8. ~/.rvm/gems/ruby-2.3.1/gems/nanoc-4.2.1/lib/nanoc/base/repos/site_loader.rb:12:in `new_from_cwd'
   9. ~/.rvm/gems/ruby-2.3.1/gems/guard-nanoc-2.0.0/lib/guard/nanoc.rb:63:in `block in recompile'
  10. ~/.rvm/gems/ruby-2.3.1/gems/guard-nanoc-2.0.0/lib/guard/nanoc.rb:62:in `chdir'
  11. ~/.rvm/gems/ruby-2.3.1/gems/guard-nanoc-2.0.0/lib/guard/nanoc.rb:62:in `recompile'
  12. ~/.rvm/gems/ruby-2.3.1/gems/guard-nanoc-2.0.0/lib/guard/nanoc.rb:23:in `run_all'
  13. ~/.rvm/gems/ruby-2.3.1/gems/guard-2.14.0/lib/guard/runner.rb:82:in `block in _supervise'
  14. ~/.rvm/gems/ruby-2.3.1/gems/guard-2.14.0/lib/guard/runner.rb:79:in `catch'
  15. ~/.rvm/gems/ruby-2.3.1/gems/guard-2.14.0/lib/guard/runner.rb:79:in `_supervise'
  16. ~/.rvm/gems/ruby-2.3.1/gems/guard-2.14.0/lib/guard/runner.rb:22:in `block (3 levels) in run'
@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jun 28, 2016

Member

This is odd!

Can you print the bytes of the string? My suspicion is that there is an invisible character in front of the slash.

Member

ddfreyne commented Jun 28, 2016

This is odd!

Can you print the bytes of the string? My suspicion is that there is an invisible character in front of the slash.

@jm3

This comment has been minimized.

Show comment
Hide comment
@jm3

jm3 Jun 28, 2016

hm, nope. the only line in the app referencing "default" is Rules, which specifies the layout like this:

compile '/*/' do
  if item[:extension] == 'sass'
    filter :sass, style: :compressed
  else
    filter :haml
    layout 'default'
  end
end

i re-typed the whole layout 'default'' line to verify that there are no invisible characters, but I still get the same Nanoc::Identifier::InvalidPrefixError error 😢

jm3 commented Jun 28, 2016

hm, nope. the only line in the app referencing "default" is Rules, which specifies the layout like this:

compile '/*/' do
  if item[:extension] == 'sass'
    filter :sass, style: :compressed
  else
    filter :haml
    layout 'default'
  end
end

i re-typed the whole layout 'default'' line to verify that there are no invisible characters, but I still get the same Nanoc::Identifier::InvalidPrefixError error 😢

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jun 28, 2016

Member

Oh—the error refers to the item_root or layouts_root in the configuration (which has to start with a slash). The error message itself is broken; a fix for that is coming up soon.

Replace

        raise InvalidPrefixError.new(@string)

with

        raise InvalidPrefixError.new(string)

and you’ll get the actual error message.

Can you share your nanoc.yaml (or config.yaml)?

Member

ddfreyne commented Jun 28, 2016

Oh—the error refers to the item_root or layouts_root in the configuration (which has to start with a slash). The error message itself is broken; a fix for that is coming up soon.

Replace

        raise InvalidPrefixError.new(@string)

with

        raise InvalidPrefixError.new(string)

and you’ll get the actual error message.

Can you share your nanoc.yaml (or config.yaml)?

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jun 28, 2016

Member

PR for the fix of the error message is in #879.

Member

ddfreyne commented Jun 28, 2016

PR for the fix of the error message is in #879.

@ddfreyne ddfreyne added this to the 4.2.2 milestone Jun 28, 2016

@jm3 jm3 closed this Jun 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment