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

git serve can't restart when file changes #1379

Open
SimonTart opened this Issue Jun 10, 2016 · 43 comments

Comments

Projects
None yet
@SimonTart

SimonTart commented Jun 10, 2016

I built gitbook serve success, but when I change file the gitbook serve restart fail.
Here is the error message.

Starting server ...
Serving book on http://localhost:4000
Restart after change in file SUMMARY.md

Stopping server
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: EPERM: operation not permitted, lstat 'G:\gitbook-touchevent\_book'
    at Error (native)

node version:4.4.2
gitook version: 2.2.0

@thoemmi

This comment has been minimized.

thoemmi commented Jun 15, 2016

I'm experiencing the same issue, though the error message is slightly different:

Error: EPERM: operation not permitted, mkdir 'D:\testbook_book'

Node: 4.4.5
Gitbook: 2.2.0

@ArpiaPsuv

This comment has been minimized.

ArpiaPsuv commented Jul 30, 2016

I have the same problem

 gitbook serve
Live reload server started on port: 35729
Press CTRL+C to quit ...

info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
info: >> generation finished with success in 1.0s !

Starting server ...
Serving book on http://localhost:4000
Restart after change in file SUMMARY.md

Stopping server

Error: EPERM: operation not permitted, mkdir 'C:\Users\cleopatra\Desktop\abum_code\_book'

Microsoft Windows [Versión 10.0.10586]

node -v
v4.4.7

gitbook -V
CLI version: 2.3.0
GitBook version: 3.2.0

@eminoda

This comment has been minimized.

eminoda commented Aug 10, 2016

md file changed, operation not permitted

@marshhj

This comment has been minimized.

marshhj commented Aug 20, 2016

I meet tooooooo!!

@CoDEmanX

This comment has been minimized.

CoDEmanX commented Sep 14, 2016

Having this problem too.

  • NodeJS v6.2.0
  • CLI version: 2.2.0
  • GitBook version: 3.2.0

Starting server ...
Serving book on http://localhost:4000
Restart after change in file SUMMARY.md

Stopping server

Error: EPERM: operation not permitted, mkdir 'C:...\gitbook3\Manual_book'

@leohxj

This comment has been minimized.

leohxj commented Sep 18, 2016

Same problem:

Stopping server
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: EPERM: operation not permitted, lstat 'F:\leo-workspace\share\gitbook\gitbook-demo\_book'
    at Error (native)

F:\leo-workspace\share\gitbook\gitbook-demo>gitbook -V
CLI version: 2.3.0
GitBook version: 3.2.0

F:\leo-workspace\share\gitbook\gitbook-demo>node --version
v4.2.0

F:\leo-workspace\share\gitbook\gitbook-demo>npm --version
3.10.6
@craigbutcher

This comment has been minimized.

craigbutcher commented Sep 23, 2016

Same issue here.

  • Windows 7 N
  • NodeJS v6.5.0
  • CLI version: 2.3.0
  • GitBook version: 3.2.0
Starting server ...
Serving book on http://localhost:4000
Restart after change in file environments\list-of-environments.md

Error: EPERM: operation not permitted, open 'C:\Users\craig\playground\gitbook\_book\456\README.md'

I'm not sure why it is trying to access the README.md even the file is available?

@CliffHan

This comment has been minimized.

CliffHan commented Oct 20, 2016

same issue, EPERM on mkdir operation, windows 10

@budiadiono

This comment has been minimized.

budiadiono commented Oct 24, 2016

I have same issue with Windows 10. While waiting for this issue get resolved, I've created gulp task using browser-sync and gulp-run to replace gitbook serve in my project:

// gulpfile.js

var browserSync = require('browser-sync');
var gulp = require('gulp')
var run = require('gulp-run')

gulp.task('browser-sync', function() {
    browserSync({
        server: {
            baseDir: "./docs/_book"
        }
    });
});

gulp.task('build-doc', function () {
    run('npm run docs:build').exec('', function() {
        run('echo docs:build DONE!').exec().pipe(browserSync.reload({stream:true}));
    });

})

gulp.task('watch', function() {
    gulp.watch('./docs/**/*.md', ['build-doc']);
})

gulp.task('default', ['build-doc', 'browser-sync', 'watch']);
// package.json

"scripts": {
  "docs:build": "cd docs && gitbook build",
  ... 

Maybe this could help someone life. Or any better idea?

UPDATE
This one: https://gist.github.com/budiadiono/dd409e2168c801c9e7429766ee0101c3 is much better.

@mlidbom

This comment has been minimized.

mlidbom commented Oct 27, 2016

Same problem as #1309?

@mlidbom

This comment has been minimized.

mlidbom commented Oct 27, 2016

I have a branch on a public repository where I see this problem every time any file is updated: https://github.com/mlidbom/AsciiDocScratch/tree/gitbook-serve-bug-repro

Hope this might help with tracking down the problem.

@budiadiono

This comment has been minimized.

budiadiono commented Oct 30, 2016

In Windows 10, the problem gone when I run gitbook serve from git bash maybe this is Windows issue with bash command instead?

I'm using these versions:

Gitbook CLI version: 2.3.0
GitBook version: 3.2.2
Node v6.9.1
@CliffHan

This comment has been minimized.

CliffHan commented Oct 31, 2016

To budiadiono:
I just tried git bash, and the problem still exists with the same response.
"Error: EPERM: operation not permitted, mkdir '....._book'"

Gitbook CLI version: 2.3.0
GitBook version: 3.2.2
Node v4.4.7

@budiadiono

This comment has been minimized.

budiadiono commented Oct 31, 2016

Hi @CliffHan, what is the emulator version of gitbash did you use? My machine installed with git version 2.5.1.windows.1 along with gitbash that using mintty emulator version 2.0.3 (x86_64-pc-msys). Maybe to workaround you want to use msys2 instead?

@CliffHan

This comment has been minimized.

CliffHan commented Oct 31, 2016

Hi @budiadiono , my git version is 2.9.2 for windows.
bash version:
GNU bash, version 4.3.46(2)-release-(x86_64-pc-msys)
msys2? Maybe I'd like to give a try.

@CliffHan

This comment has been minimized.

CliffHan commented Nov 4, 2016

Last Friday it worked normally, and today it failed again.
I DO think it's some kind of permission issue, with some gitbook/nodejs service or service they used.

@cortexcompiler

This comment has been minimized.

cortexcompiler commented Nov 8, 2016

I see this issue on Windows also. I have seen some threads related to grunt that say you can avoid the problem by running the CMD window as administrator. I am not a big fan of that solution but it may work for some.

@ghost

This comment has been minimized.

ghost commented Dec 15, 2016

+1 fails quite often, Windows 7

@githoniel

This comment has been minimized.

githoniel commented Feb 20, 2017

+1 fails quite often, Windows 10

@iulo

This comment has been minimized.

iulo commented Mar 13, 2017

any update?

@jptissot

This comment has been minimized.

jptissot commented Mar 15, 2017

Same for me, I see this error everytime I save a file.

I'm using

  • Windows 10 Latest update
  • VSCode 1.10.2 integrated Powershell
  • node v7.7.2.
  • GitBook 3.2.2
@teaho2015

This comment has been minimized.

teaho2015 commented Mar 18, 2017

Same problem.

  • Windows version: 8.1
  • node version: v6.9.4
  • Gitbook version: 3.2.2
@marekgregor

This comment has been minimized.

marekgregor commented Mar 21, 2017

I suppose issue relates to weird inability to change read-only flag on folder in Windows
I haven't fixed the cause of this problem, but I have one very dumb workaround to the consequence - just create and run this .bat file in the console window - it will automatically call gitlab serve command after it will crash:

@Echo off
:Start
call gitbook serve
goto Start

@mistory

This comment has been minimized.

mistory commented Apr 25, 2017

same, windows 7
CLI version: 2.3.0
GitBook version: 3.0.2
node version: 4.4.4

@YUFENGWANG

This comment has been minimized.

YUFENGWANG commented Apr 28, 2017

any solutions? this really bother me a lot. I have to go back to my Ubuntu again...

@wz5891

This comment has been minimized.

wz5891 commented May 24, 2017

the old version 2.6.7 can live relaod on win10

gitbook fetch 2.6.7
gitbook -v 2.6.7
gitbook serve --gitbook=2.6.7
@ska2342

This comment has been minimized.

ska2342 commented Aug 3, 2017

I'd like to add another mee too. This is keeping us from starting with Gitbook at all, because the majority of our authors is on Windows and the local server crashes on every single change.

@creatop-john

This comment has been minimized.

creatop-john commented Aug 7, 2017

Here's a solution

  1. gitbook serve
  2. delete _book folder once
  3. now each time you change the md file, the server will stop and start over again and again
@wangluzhou

This comment has been minimized.

wangluzhou commented Aug 18, 2017

@creatop-john Thanks, it solved my problem!

@jptissot

This comment has been minimized.

jptissot commented Aug 25, 2017

For us, the issue turned out to be a blank .md file, after inserting dummy data in it, gitbook serve worked properly.

@ouweiya

This comment has been minimized.

ouweiya commented Sep 25, 2017

@creatop-john Thank you for running successfully, but the refresh is too slow to affect the writing experience.

@tonnyone

This comment has been minimized.

tonnyone commented Dec 20, 2017

@creatop-john Thank you for running successfully

@SkyRockMoon

This comment has been minimized.

SkyRockMoon commented Feb 13, 2018

I am still seeing problems with this:

Windows 7 SP1 64-bit
Node v8.9.4
npm 5.6.0

Starting from scratch this is what I did:
npm install gitbook-cli -g
gitbook init ./gitbooktest
gitbook serve

When I saved a change to README.md it breaks. See below.


> C:\Code\docs\gitbooktest>gitbook serve
> Live reload server started on port: 35729
> Press CTRL+C to quit ...
> 
> info: 7 plugins are installed
> info: loading plugin "livereload"... OK
> info: loading plugin "highlight"... OK
> info: loading plugin "search"... OK
> info: loading plugin "lunr"... OK
> info: loading plugin "sharing"... OK
> info: loading plugin "fontsettings"... OK
> info: loading plugin "theme-default"... OK
> info: found 1 pages
> info: found 0 asset files
> info: >> generation finished with success in 0.6s !
> 
> Starting server ...
> Serving book on http://localhost:4000
> Restart after change in file README.md
> 
> Stopping server
> events.js:183
>       throw er; // Unhandled 'error' event
>       ^
> 
> Error: EPERM: operation not permitted, lstat 'C:\Code\docs\gitbooktest\_book'
> 
> C:\Code\docs\gitbooktest>node -v
> v8.9.4
> 
> C:\Code\docs\gitbooktest>npm -v
> 5.6.0

@DexterHaslem

This comment has been minimized.

DexterHaslem commented Feb 13, 2018

I'll dogpile in as well, just curious what the status of this is.
Are there plans to bump dependencies like some of the forks have? is it just waiting for someone to PR?

@frantzyy

This comment has been minimized.

frantzyy commented Feb 19, 2018

I had the same issue but noticed that my SUMMARY.md didn't include all the links to pages I was trying to access. Once I added them I was able update files and have the "gitbook serve" restart successfully. Might not be the same issue you all are seeing just wanted to point that out.

@themaawaa

This comment has been minimized.

themaawaa commented Apr 19, 2018

Same here . While @creatop-john 's solution worked at first, when using chapters I am unable to delete the /book even though I have full admin privileges.

@wslx520

This comment has been minimized.

wslx520 commented Jul 7, 2018

Two years past, the bug is still here, what have happened?!

@unzoa

This comment has been minimized.

unzoa commented Jul 10, 2018

really

@wikilike7

This comment has been minimized.

wikilike7 commented Jul 26, 2018

Same error, Anyone have new solution?

@mulder21c

This comment has been minimized.

mulder21c commented Aug 8, 2018

I have same issue also.

I tried the steps below, and I could see that they would be reloaded without problems.

run gitbook serve

$ gitbook serve

on another terminal

$ rm ./_book -r -f

modify & save some files

then, reload & livereload work well.

Restart after change in file README.md

Stopping server
info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
info: >> generation finished with success in 0.6s !

Starting server ...
Serving book on http://localhost:4000
@themaawaa

This comment has been minimized.

themaawaa commented Aug 9, 2018

This is unfortunately only a temporary solution @mulder21c

@tehcon

This comment has been minimized.

tehcon commented Oct 15, 2018

Win10 64bit
I run "gitbook serve" in an Administrator cmd and it works well

@wslx520

This comment has been minimized.

wslx520 commented Oct 16, 2018

Maybe someone need: alternative solution for this, vuepress, new, easy to use, more powerful and well maintained

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