Skip to content

Error: different prefix: "/" and "G:/" #4677

Closed
@dbc60

Description

@dbc60
What version of Jekyll are you using (jekyll -v)?

jekyll 3.0.3

What operating system are you using?

Windows 10 x64

What did you do?

Being a lazy developer I got tired of typing a long path to my GitHub repository where I run Jekyll, so I created a script to run at login time that uses the subst command to associate a drive letter with the path:

 subst G: E:\<long-path>\GitHub\dbc60.github.io

Now I can just type G: in my console and be instantly transported to my repo. Unfortunately Jekyll crashes with an error about different prefixes.

That said, there is a simple workaround for the problem described below. I can set G: to the parent directory and cd to the repo before running Jekyll. It's just that the crash was surprising, so I thought you should know about it.

Anyway, here's what I did. I ran bundle exec jekyll s --drafts

What did you expect to see?

I expected something like:

G:\> bundle exec jekyll s --trace
Configuration file: G:/_config.yml
            Source: G:/
       Destination: G:/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    done in 4.408 seconds.
 Auto-regeneration: enabled for 'G:/'
Configuration file: G:/_config.yml
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.
What did you see instead?

Here's the error output:

G:\> bundle exec jekyll s --drafts
Configuration file: /_config.yml
            Source: G:/
       Destination: G:/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
jekyll 3.0.3 | Error:  different prefix: "/" and "G:/"

I reran the command with the --trace option:

G:\> bundle exec jekyll s --trace
Configuration file: /_config.yml
            Source: G:/
       Destination: G:/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
E:/Apps/Ruby22/lib/ruby/2.2.0/pathname.rb:508:in `relative_path_from': different prefix: "/" and "G:/" (ArgumentError)
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/document.rb:93:in `relative_path'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/document.rb:85:in `draft?'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/document.rb:27:in `initialize'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/readers/post_reader.rb:55:in `new'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/readers/post_reader.rb:55:in `block in read_content'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/readers/post_reader.rb:52:in `map'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/readers/post_reader.rb:52:in `read_content'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/readers/post_reader.rb:35:in `read_publishable'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/readers/post_reader.rb:25:in `read_posts'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/reader.rb:59:in `retrieve_posts'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/reader.rb:46:in `read_directories'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/reader.rb:17:in `read'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/site.rb:144:in `read'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/site.rb:57:in `process'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/command.rb:28:in `process_site'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/commands/build.rb:60:in `build'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/commands/build.rb:35:in `process'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/lib/jekyll/commands/serve.rb:26:in `block (2 levels) in init_with_program'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from E:/Apps/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.3/bin/jekyll:17:in `<top (required)>'
    from E:/Apps/Ruby22/bin/jekyll:23:in `load'
    from E:/Apps/Ruby22/bin/jekyll:23:in `<main>'

Activity

parkr

parkr commented on Mar 19, 2016

@parkr
Member

Looks like a bug to me in Jekyll::Configuration.

/cc @jekyll/windows

envygeeks

envygeeks commented on Mar 19, 2016

@envygeeks
Contributor

It's a bug in Pathname, Pathname does simplistic checking for performance and it's not very Windows friendly. "G:/" doesn't match "/" so it will always fail unless G:\ is the root of Windows (then it really is a bug.) I'll be on Windows tomorrow working on some unrelated stuff so I'll run Pry and see what I can come up with an replicate independent of Jekyll so we can figure out if we can fix this problem easily or not.

suriyaa

suriyaa commented on Apr 3, 2016

@suriyaa
Member

@envygeeks is right. 👍

Using Pathname on Windows isn't the best idea.


@dbc60 Try to use this command:

subst G:\ E:\<long-path>\GitHub\dbc60.github.io
dbc60

dbc60 commented on Apr 6, 2016

@dbc60
Author

@SuriyaaKudoIsc The subst command doesn't allow a backslash for the first argument:

C:\> subst G:\ E:\Users\Doug\Projects\Github\dbc60.github.io
Invalid parameter - G:\

but it does automatically put it in:

C:\> subst
H:\: => E:\Users\Doug\Projects\Handmade\dev
N:\: => C:\Users\Doug\Notes
P:\: => E:\Users\Doug\Projects
S:\: => E:\Users\Doug\Projects\Sandbox
added this to the flexible milestone on Apr 14, 2016
jekyllbot

jekyllbot commented on Jun 6, 2016

@jekyllbot
Contributor

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If you can still reproduce this error on the 3.1-stable or master branch,
please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider building it first as a plugin. Jekyll 3 introduced
hooks which provide convenient access points throughout
the Jekyll build pipeline whereby most needs can be fulfilled. If this is something that cannot be
built as a plugin, then please provide more information about why in order to keep this issue open.

Thank you for all your contributions.

added
staleNobody stepped up to work on this issue.
on Jun 6, 2016
removed
staleNobody stepped up to work on this issue.
on Jun 6, 2016
envygeeks

envygeeks commented on Jun 6, 2016

@envygeeks
Contributor

This isn't stale, this is an actual bug in Pathname that Pathutil will be trying to solve for Jekyll.

self-assigned this
on Jun 6, 2016
dbc60

dbc60 commented on Jun 6, 2016

@dbc60
Author

It's still happening with Jekyll v3.1.6.

envygeeks

envygeeks commented on Jun 6, 2016

@envygeeks
Contributor

@dbc60 it will happen until I either make sure Pathutil doesn't have this bug also and fix it and then move our stuff to Pathutil the rest of the way or, Pathname suddenly decides to fix it (doubtful since they've been told before.)

26 remaining items

soFlyMan

soFlyMan commented on Aug 1, 2016

@soFlyMan

I get the same issue.My English is poor.Can somebody tell me is there any solution?

jake-low

jake-low commented on Aug 1, 2016

@jake-low

@soFlyMan: Try this:

gem uninstall jekyll -v 3.2.0
gem install jekyll -v 3.1.6
soFlyMan

soFlyMan commented on Aug 1, 2016

@soFlyMan

@jake-low Thank you,I have solved the problem.

erikjohnsen6d

erikjohnsen6d commented on Aug 1, 2016

@erikjohnsen6d

@parkr I can test, but not sure how to install a gem from source code like that.

parkr

parkr commented on Aug 3, 2016

@parkr
Member
sasivarnan

sasivarnan commented on Aug 3, 2016

@sasivarnan

Thanks for the fix.

I am facing another issue. I am getting the following error when I try to do jekyll serve or bundle exec jekyll serve.

  Error reading file C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/default.html: No such file or directory @ rb_sysopen - /Ruby23-x64/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/default.html Error reading file C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/page.html: No such file or directory @ rb_sysopen - /Ruby23-x64/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/page.html Error reading file C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/post.html: No such file or directory @ rb_sysopen - /Ruby23-x64/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/post.html

I already tried gem cleanup and bundle install. I am still getting the same error.

parkr

parkr commented on Aug 3, 2016

@parkr
Member

@sasivarnan Tracking that in #5192

removed this from the flexible milestone on May 1, 2018
locked and limited conversation to collaborators on Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @envygeeks@DirtyF@parkr@sanumala@sangimed

        Issue actions

          Error: different prefix: "/" and "G:/" · Issue #4677 · jekyll/jekyll