Open maiertech opened 10 years ago
Hi there
Sorry I havn't tested this on windows yet - can you compile Jekyll normally from the command line (without using gulp)?
Jekyll works fine on command-line. My workaround is use Grunt to launch BrowserSync.
Just change this: return cp.spawn('jekyll', ['build'], {stdio: 'inherit'}).on('close', done);
for this: return cp.exec('jekyll', ['build'], {stdio: 'inherit'}).on('close', done);
@sergiokopplin have you tested this works on windows?
I tried, without success, had seen this on stackoverflow and it seemed to work. Incidentally, I went back to using the browser-sync today and I came across many problems and could not use. Other browsers can not connect to internal network of my house. I used both the browser-sync in its simple form, as well as the Grunt and the Gulp.
Updating.
I had a problem on my machine because I could not run the browser-sync, asked for help from friends and some developers still unable to diagnose. I formatted the machine and now it worked without problems.
Follows the line I changed:
('Jekyll', ['build'], {stdio: 'inherit'}) return cp.exec
I had similar issue and used:
return cp.spawn('jekyll.bat', ['build'], {stdio: 'inherit'}).on('close', done);
To keep your code platform independent, you can add
var jekyll = process.platform === "win32" ? "jekyll.bat" : "jekyll";
and then use
return cp.spawn(jekyll, ['build'], {stdio: 'inherit'}).on('close', done);
It also fails on Mac OS 10.10
--- OSS/jekyll-gulp-sass-browser-sync ‹master› » gulp
[11:57:25] Using gulpfile ~/Projects/OSS/jekyll-gulp-sass-browser-sync/gulpfile.js
[11:57:25] Starting 'sass'...
[11:57:25] Starting 'jekyll-build'...
[11:57:25] Starting 'watch'...
[11:57:25] Finished 'watch' after 10 ms
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
I've added an error handler to the gulpfile.js to track the error and here we go:
--- OSS/jekyll-gulp-sass-browser-sync ‹master* M› » gulp
[21:11:14] Using gulpfile ~/Projects/OSS/jekyll-gulp-sass-browser-sync/gulpfile.js
[21:11:14] Starting 'sass'...
[21:11:14] Starting 'jekyll-build'...
[21:11:14] Starting 'watch'...
[21:11:14] Finished 'watch' after 10 ms
Error: spawn ENOENT
[21:11:14] 'jekyll-build' errored after 16 ms
[21:11:14] Error: -1
at formatError (/usr/local/lib/node_modules/gulp/bin/gulp.js:169:10)
at Gulp.<anonymous> (/usr/local/lib/node_modules/gulp/bin/gulp.js:195:15)
at Gulp.emit (events.js:95:17)
at Gulp.Orchestrator._emitTaskDone (/Users/okonet/Projects/OSS/jekyll-gulp-sass-browser-sync/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
at /Users/okonet/Projects/OSS/jekyll-gulp-sass-browser-sync/node_modules/gulp/node_modules/orchestrator/index.js:275:23
at finish (/Users/okonet/Projects/OSS/jekyll-gulp-sass-browser-sync/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
at ChildProcess.cb (/Users/okonet/Projects/OSS/jekyll-gulp-sass-browser-sync/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Still unclear why it's happening. I've installed jekyll
using gem install jekyll
which jekyll
jekyll: aliased to bundled_jekyll
The problem was the bundler
. In this case it should look like:
return cp.spawn('bundle', ['exec', 'jekyll', 'build'], {stdio: 'inherit'})
Installing another Ruby version worked for me (2.1.6).
[15:06:32] Task 'install' is not in your gulpfile [15:06:32] Please check the documentation for proper gulpfile formatting
What should I do, can anyone help me ?
it doesn't work on windows anyhow... using jekyll independently is good...
Hi, When I run the command gulp and my browser opens in localhost:3000 I get the error 'Cannot GET /'
@AcarMeel, did you checked another url like "localhost:3000/index.html"? Or maybe with your application folder. In my case my url is like "localhost:3000/app/index.html"
@sergiokopplin but in my _site folder I don't have any html file (index.html) . Is not compiling any html files just the styles.
anyone found a solution for this script on Windows? I tried lots of methods but none seems to work, I'm using this on Windows 10. Thanks in advanced!
*Edit: Okay, so I used the code below:
gulp.task('jekyll-build', function (done){
//var jekyll = process.platform === "win32" ? "jekyll.bat" : "jekyll";
return cp.spawn('jekyll.bat', ['build'], {stdio: 'inherit'})
.on('close', done);
});
and it worked, but I had to exclude node_modules in my _config.yml. And also my rebuild task is taking a bit slow, I will try to optimize it and post the code here :) Thanks Shane for making this script! :+1:
This is my gulpfile for Jekyll to work with Gulp on Windows (10), anyone who want the script please feel free to download and use it and also Star the repo if you like it :) Again thanks Shane for uploading the original work, mine just has different structures and modified gulpfile so it can work on Windows.
https://github.com/steven-to/gulp-jekyll-browsersync/blob/gh-pages/gulpfile.js
My new build a starter project with Jekyll and other tools (Win, Mac, Lin): https://github.com/agragregra/jekyll-gulp-autoprefixer-sass-bourbon-jade-browser-sync
You can use gulp-shell to run jekyll or bunlde exec jekyll
var shell = require('gulp-shell');
// Task for building blog when something changed:
gulp.task('jekyll-build', shell.task(['bundle exec jekyll build']));
// Or if you don't use bundle:
// gulp.task('build', shell.task(['jekyll build']));
nah, you shouldn't.
"gulp-shell": "promotes anti-patterns, use gulp-exec or child_process"
https://github.com/gulpjs/plugins/blob/master/src/blackList.json
hi there! I face this problem and I tried to use the command line prompt with ruby. and worked!
Yeah! like @MuhammadSayedMorsi said windows users please use the 'command line prompt with ruby' to run the gulp. It will work!.
I have tried your script on Mac and it works fine. At work I have to use Windows and my setup is RubyInstaller 1.9.3-p545 with Node 0.10.26.
I get the following error, which seems related to the child process. Any idea what goes wrong?