robwierzbowski / generator-jekyllrb

Supercharge Jekyll development with Yeoman. Yo, Jekyllrb!
BSD 3-Clause "New" or "Revised" License
595 stars 65 forks source link

Generator fails, no such file or directory '.../app/css/main.css' #11

Closed tinderfields closed 9 years ago

tinderfields commented 11 years ago

Installing and running generator-jekyllrb for the first time

fs.js:684
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/Users/paulodeon/yeomantest4/app/css/main.css'
    at Object.fs.statSync (fs.js:684:18)
    at Generator.<anonymous> (/usr/local/share/npm/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/actions/actions.js:97:16)
    at EventEmitter.g (events.js:175:14)
    at EventEmitter.emit (events.js:95:17)
    at /usr/local/share/npm/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:59:18
    at EventEmitter.collision (/usr/local/share/npm/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:140:12)
    at next (/usr/local/share/npm/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:54:16)
    at /usr/local/share/npm/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:60:7
    at EventEmitter.collision (/usr/local/share/npm/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:140:12)
    at next (/usr/local/share/npm/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:54:16)

Here are the config options selected:

Tell us a little about yourself. ☛
[?] Name: (Paul Odeon) 
[?] Email: (mail@paulodeon.com) 
[?] GitHub Username: (paulodeon) 
[?] Twitter Username: (@paulodeon) 

Wire tools and preprocessors. ☛
[?] Use a css preprocessor?
 s: sass
 c: compass
 n: none (n) s
[?] Use Autoprefixer? (Y/n) Y
[?] Use a javascript preprocessor?
 c: coffeescript
 n: none (n) 

Set up some directories. ☛
Nested directories are fine.
[?] Choose a css directory: (css) 
[?] Choose a javascript directory: (js) 
[?] Choose an image file directory: (image) 
[?] Choose a webfonts directory: (fonts) 
[?] Choose a css preprocessor directory: (_scss) 

Choose a template. ☛
[?] Choose a Jekyll site template
 d: default
 h5: HTML5 ★ Boilerplate (d) h5
[?] Add H5★BP css files (Y/n) y
[?] Add H5★BP javascript files? (Y/n) y
[?] Add H5★BP favorite and touch icons? (Y/n) y
[?] Add H5★BP documentation? (y/N) y
[?] Include Google Analytics? (Y/n) y

And configure Jekyll. ☛
You can change all of these options in Jekyll's _config.yml.
[?] Site Description: Site
[?] Choose a post permalink style
 d: date
 p: pretty
 n: none (d) 
[?] Markdown library
 m: maruku
 rd: rdiscount
 k: kramdown
 rc: redcarpet (m) 
[?] Use the Pygments code highlighting library? (Y/n) 
[?] Enable pagination? (Number of posts, or 'all') 
robwierzbowski commented 11 years ago

With the same settings it works on my end. Can you tell me:

Thanks for the complete bug report.

robwierzbowski commented 11 years ago

Oh, please run bundle exec jekyll -v too.

tinderfields commented 11 years ago

Hi Rob

I'm on OSX 10.8.3 Jekyll version is 1.0.2

There aren't any files at that location when it crashes...

robwierzbowski commented 11 years ago

That's curious. What node version are you running?

robwierzbowski commented 11 years ago

Couple more questions: Do you have git installed (which git) and are you connected to the internet?

tinderfields commented 11 years ago
→ node -v
v0.10.6

~ 
→ which git
/usr/local/bin/git

I am connected to the internet, yep, should I disconnect then try?

robwierzbowski commented 11 years ago

No, I was thinking that the error might have been caused by being unable to pull in the H5BP git repo.

Sorry, this is a little hard to debug because I can't reproduce. Can you check if there's a ~/.yeoman/cache/h5bp/html5-boilerplate/v4.2.0/ directory?

andymcfee commented 11 years ago

+1

I'm running an almost identical setup to @tinderfields and I'm hitting the exact same error (I'm not using H5BP, os I don't think the error is coming from there).

However, after trying a few different configs, I believe it's only failing if you choose sass or compass for a preprocessor. I was trying to build with compass and it failed. I tried again and opted not to include a css preprocessor, and ran successfully. Hope that helps to narrow down the problem!

robwierzbowski commented 11 years ago

The error is happening because the generator is trying to copy the template's css files to scss, but it's not finding them. This might be a race condition, but it shouldn't be because the template copying step and the css copying step are in synchronous methods a couple steps away from each other.

@andymcfee, can you paste your error when choosing the normal template, and also check after the error if the file exists in a hidden .jekyll folder?

robwierzbowski commented 11 years ago

If it is a race condition, this may fix it: https://github.com/yeoman/generator/issues/233. You can try manually downloading generator master, or wait for the new version to come out in a few days.

andymcfee commented 11 years ago

Setup:

Tell us a little about yourself. ☛
[?] Name: (Andy McFee)
[?] Email: (andy.mcfee@gmail.com)
[?] GitHub Username: (andymcfee)
[?] Twitter Username: (@andymcfee)

Wire tools and preprocessors. ☛
[?] Use a css preprocessor?
 s: sass
 c: compass
 n: none (n) c
[?] Use Autoprefixer? (Y/n) n
[?] Use a javascript preprocessor?
 c: coffeescript
 n: none (n) n

Set up some directories. ☛
Nested directories are fine.
[?] Choose a css directory: (css)
[?] Choose a javascript directory: (js)
[?] Choose an image file directory: (image)
[?] Choose a webfonts directory: (fonts)
[?] Choose a css preprocessor directory: (_scss)

Choose a template. ☛
[?] Choose a Jekyll site template
 d: default
 h5: HTML5 ★ Boilerplate (d)

And configure Jekyll. ☛
You can change all of these options in Jekyll's _config.yml.
[?] Site Description: grunt-jekyllrb test
[?] Choose a post permalink style
 d: date
 p: pretty
 n: none (d)
[?] Markdown library
 m: maruku
 rd: rdiscount
 k: kramdown
 rc: redcarpet (m)
[?] Use the Pygments code highlighting library? (Y/n) Y
[?] Enable pagination? (Number of posts, or 'all') 10

The error:

fs.js:684
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/Users/andyair13/Dropbox/github/grunt-jekyllrb/app/css/main.css'
    at Object.fs.statSync (fs.js:684:18)
    at Generator.<anonymous> (/Users/andyair13/local/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/actions/actions.js:97:16)
    at EventEmitter.g (events.js:175:14)
    at EventEmitter.emit (events.js:95:17)
    at /Users/andyair13/local/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:59:18
    at EventEmitter.collision (/Users/andyair13/local/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:140:12)
    at next (/Users/andyair13/local/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:54:16)
    at /Users/andyair13/local/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:60:7
    at EventEmitter.collision (/Users/andyair13/local/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:140:12)
    at next (/Users/andyair13/local/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/util/conflicter.js:54:16)

And main.css IS in the css directory inside .jekyll

robwierzbowski commented 11 years ago

Andy, thanks. Can you try this:

  1. Start with an empty directory
  2. npm install generator-jekyllrb (to create a local install)
  3. Replace the contents of ...your_test_dir/node_modules/generator-jekyllrb/node_modules/yeoman-generator/ with the contents of https://github.com/yeoman/generator master
  4. run npm install in ...your_test_dir/node_modules/generator-jekyllrb/node_modules/yeoman-generator/ to install its dependencies
  5. then try yo jekyllrb in your test folder?

Hopefully it won't error out with the new prompt system and we can see if the race condition is fixed. Pretty sure that's what's going on right now.

andymcfee commented 11 years ago

Thanks, I'll give it a try and let you know how it goes.

andymcfee commented 11 years ago

@robwierzbowski Getting some weird results. Maybe I'm doing something wrong.

Steps 1 and 2 were no problem. Step 3 however, I think I'm doing something wrong. I tried it two ways:

  1. I downloaded the zip from https://github.com/yeoman/generator. Deleted all contents from ...my_test_dir/node_modules/generator-jekyllrb/node_modules/yeoman-generator/ and replaced it with all the contents of the zip.
  2. Tried running git clone https://github.com/yeoman/generator.git in ...my_test_dir/node_modules/generator-jekyllrb/node_modules/yeoman-generator/, then deleting yeoman-generator and renaming cloned generator to yeoman-generator

After both attempts, I ran npm install in ...my_test_dir/node_modules/generator-jekyllrb/node_modules/yeoman-generator/

Then, when I ran yo jekyllrb in my_test_dir, I got this:

This generator will scaffold and wire a Jekyll site. Yo, Jekyllrb!

Tell us a little about yourself. ☛
[?] undefined: (Andy McFee)
nfinitynfinitynfinityC                                                                                                                                                                                 [?] undefined: Andy McFee
[?] Must be a valid email address: (andy.mcfee@gmail.com)
nfinitynfinitynfinityC                                                                                                                                                                                 [?] Must be a valid email address: andy.mcfee@gmail.com
[?] undefined: (andymcfee)
nfinitynfinitynfinityC                                                                                                                                                                                 [?] undefined: andymcfee
[?] undefined: (@andymcfee)
nfinitynfinitynfinityC                                                                                                                                                                                 [?] undefined: @andymcfee

events.js:74
        throw TypeError('Uncaught, unspecified "error" event.');
              ^
TypeError: Uncaught, unspecified "error" event.
    at TypeError (<anonymous>)
    at Generator.EventEmitter.emit (events.js:74:15)
    at Generator.<anonymous> (/Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/app/index.js:111:19)
    at onCompletion (/Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/node_modules/yeoman-generator/node_modules/inquirer/lib/inquirer.js:93:7)
    at /Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/node_modules/yeoman-generator/node_modules/async/lib/async.js:229:13
    at /Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/node_modules/yeoman-generator/node_modules/async/lib/async.js:139:25
    at /Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/node_modules/yeoman-generator/node_modules/async/lib/async.js:226:17
    at after (/Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/node_modules/yeoman-generator/node_modules/inquirer/lib/inquirer.js:71:7)
    at Prompt.filter (/Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/node_modules/yeoman-generator/node_modules/inquirer/lib/prompts/base.js:174:5)
    at Prompt.done (/Users/andyair13/Dropbox/github/grunt-jekyll-fix/node_modules/generator-jekyllrb/node_modules/yeoman-generator/node_modules/inquirer/lib/prompts/base.js:58:10)

Did I do something wrong at some point? I have a feeling I'm doing something wrong in Step 3, despite my trying it two different ways. Sorry if I'm making some simple mistake...

robwierzbowski commented 11 years ago

Ah, I was worried about that. The generator master uses a new prompt system which generator-jekyllrb isn't updated with yet. I was hoping the errors wouldn't be fatal.

I'll see if I can patch up a test branch later on without the new prompt and post it here. Might have to wait until generator 12.0 is released though.

robwierzbowski commented 11 years ago

Ah, I can finally recreate, with generator 12.0 though. I'll see if I can fix this up soon.

robwierzbowski commented 11 years ago

Alright, I figured out what's going on. Actions.copy has time to copy the file, but then goes back and tries to read the file's modified dates and copy them to the destination file. Copy is racing the delete task that's fired after it. It wins the race to copy the file, but loses the race to read the stats.

I've created a branch that moves the cleanup command into a callback that should fire only after actions.copy is completed.

@andymcfee and @tinderfields, can you try downloading https://github.com/robwierzbowski/generator-jekyllrb/tree/fix-race and see if it fixes the issue for you?

robwierzbowski commented 11 years ago

You know what, I'm 90% sure this fixes the problem, so I just rolled a new npm release. Try downloading the latest generator-jekyllrb and see if all is good.

tinderfields commented 11 years ago

Thanks - that seems to have fixed it. Did a fresh install and it just worked.

Look forward to playing with it!

robwierzbowski commented 11 years ago

Nice! Thanks for the confirmation.

gabekelley commented 10 years ago

Hey Im having this same issue again and I've just installed a few days ago.

robwierzbowski commented 10 years ago

I'm working on a large update to this generator over the next few weeks, and probably won't have time to investigate this myself. Please log anything you do to test/fix this; if you figure out the cause but can't roll a PR I'll do my best to roll one for you, and if you can roll a PR :smile_cat: :rocket: :ghost: :heart_eyes:.

aboutaaron commented 9 years ago

Seeing this issue again with a fresh install of 0.12 and io.js 1.2.0; and jekyll 1.4.3

This with h5bp and no preprocessor

events.js:125
      throw er; // Unhandled 'error' event
            ^
Error: ENOENT: no such file or directory, open '/home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/app/templates/conditional/template-h5bp/index.html'
    at Error (native)
    at Object.fs.openSync (fs.js:540:18)
    at Object.fs.readFileSync (fs.js:392:15)
    at Generator._prepCopy (/home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/actions/actions.js:37:17)
    at Generator.copy (/home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/actions/actions.js:70:19)
    at Generator.templates (/home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/app/index.js:457:10)
    at /home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/base.js:409:16
    at processImmediate [as _immediateCallback] (timers.js:321:17)

With preprocessor:

events.js:125
      throw er; // Unhandled 'error' event
            ^
Error: ENOENT: no such file or directory, open '/home/aaron/Code/labs/danielle/.jekyll/css/main.scss'
    at Error (native)
    at Object.fs.openSync (fs.js:540:18)
    at Object.fs.readFileSync (fs.js:392:15)
    at Generator._prepCopy (/home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/actions/actions.js:37:17)
    at Generator.copy (/home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/actions/actions.js:70:19)
    at Generator.templates (/home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/app/index.js:443:10)
    at /home/aaron/.nvm/versions/io.js/v1.2.0/lib/node_modules/generator-jekyllrb/node_modules/yeoman-generator/lib/base.js:409:16
    at processImmediate [as _immediateCallback] (timers.js:321:17)
aboutaaron commented 9 years ago

My problem looks like it was related to having an old version of Jekyll. Upgrade to 2.5.3 seems to have solved my issues.