Skip to content
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

random errors when using gitbook plugin on running "gitbook serve". #1309

Closed
sachetsharma opened this issue May 18, 2016 · 78 comments
Closed

Comments

@sachetsharma
Copy link

We are running gitbook with some plugins. Plugins are loaded fine but at the end it errors out with different error messages. All of them complains about one or the other plugin file missing. Running gitbook version 2.1.3 on windows 7.

info: 7 plugins are installed
info: loading plugin "prism"... OK
info: loading plugin "edit-link"... OK
info: loading plugin "livereload"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 66 pages
info: found 83 asset files

Error: ENOENT: no such file or directory, stat 'C:\Projects\myproject_book\gitbook\gitbook-plugin-fontsettings\buttons.js'

Error: ENOENT: no such file or directory, stat 'C:\Projects\myproject_book\gitbook\gitbook-plugin-lunr\lunr.min.js'

Error: ENOENT: no such file or directory, stat 'C:\Projects\myproject_book\gitbook\gitbook-plugin-livereload\plugin.js'

@SamyPesse SamyPesse added the bug label May 18, 2016
@SamyPesse
Copy link
Member

Can you paste me the output of gitbook current inside the book's directory?

@SamyPesse
Copy link
Member

And also the output of node -v ?

@sachetsharma
Copy link
Author

here is the output

C:\Projects\myproject_book>gitbook current
GitBook version is 2.6.7

C:\Projects\myproject_book>node -v
v4.2.2

@SamyPesse
Copy link
Member

Run gitbook current inside the C:\Projects\myproject (I guess this is folder where your content is stored), and paste me the output.

@sachetsharma
Copy link
Author

Here it is:
C:\Projects\myproject>gitbook current
GitBook version is 3.0.0-pre.15

@SamyPesse
Copy link
Member

Ok thanks, I'll investigate and fix this.

@fractalf
Copy link

I get the same..

alf@dev [~/gitbook] gitbook init ./foobar
warn: no summary file in this book
info: create README.md
info: create SUMMARY.md
info: initialization is finished
alf@dev [~/gitbook] cd foobar/
alf@dev [~/gitbook/foobar] node -v
v4.4.5
alf@dev [~/gitbook/foobar] gitbook current
GitBook version is 3.0.3
alf@dev [~/gitbook/foobar] gitbook build
info: 6 plugins are installed
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

Error: ENOENT: no such file or directory, stat '/nfs/home/alf/gitbook/foobar/_book/gitbook/gitbook-plugin-lunr/lunr.min.js'

@superbull
Copy link

I have the same problem in Windows7.

gitbook version: 3.0.3
node version: v5.5.0

I found that when the error message said:

Error: ENOENT: no such file or directory, stat '/nfs/home/alf/gitbook/foobar/_book/gitbook/gitbook-plugin-lunr/lunr.min.js'

the file lunr.min.js is there, but the size of this file is 0.

@xNok
Copy link

xNok commented Jun 9, 2016

I have the similar problems in Windows7

Error: EPERM: operation not permitted, mkdir 'D:\www2\thinxtraPortal\cssb\_book'

Error: EPERM: operation not permitted, open 'D:\www2\thinxtraPortal\cssb\_book\part1-automated-workflow\cssb_automated_workflow.md'

Error: EPERM: operation not permitted, lstat 'D:\www2\thinxtraPortal\cssb\_book'

gitbook version: 3.1.0
node version: v5.6.0

The first thing I haved notice is that gitbook create a read only _book directory.
This seems to solve the 2 first issues but not the last one with lstat

@maiertech
Copy link

I get the same on Windows 7 with GitBook 3.1.1 and Node 6.2.1.

@takao-mizuno
Copy link

I ran into the same problem on Windows7 with GitBook 3.1.0 and Node 6.3.0.
How's this problem going ?

@zargex
Copy link

zargex commented Jul 13, 2016

Hi, I have the same error, but in Linux

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

info: 7 plugins are installed 
info: 6 explicitly listed 
info: loading plugin "livereload"... OK 
info: loading plugin "highlight"... OK 
info: loading plugin "search"... OK 
info: loading plugin "lunr"... OK 
info: loading plugin "fontsettings"... OK 
info: loading plugin "theme-default"... OK 
info: found 1 pages 
info: found 0 asset files 

Error: ENOENT: no such file or directory, stat '/home/aparra/Documentos/zoi-api/book/_book/gitbook/gitbook-plugin-livereload/plugin.js'

gitbook --version CLI version: 2.3.0 GitBook version: 3.2.0

node --version v4.4.7
But I looked at that directory and there is plugin.js, so I don't understand.
Thanks

@letmaik
Copy link

letmaik commented Jul 14, 2016

Same:

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 12 pages
info: found 15 asset files

Error: ENOENT: no such file or directory, stat '...\_book\gitbook\gitbook-plugin-fontsettings\fontsettings.js'

Everytime a different file. On Windows with 3.2.0.

@hamdichau
Copy link

The same.

@eyinsma
Copy link

eyinsma commented Aug 4, 2016

The same issue on Windows 7.
GitBook version is 3.2.0
Node v6.3.1

@tanbro
Copy link

tanbro commented Aug 9, 2016

The same error on windows 10 when auto restarting server

node v4.4.7, gitbook 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 'D:\repos\yunhuni-server-api-docs\_book'

@ghost
Copy link

ghost commented Aug 19, 2016

Error: ENOENT: no such file or directory, stat 'D:\topsecgitbook\_book\gitbook\gitbook-plugin-fontsettings\fontsettings.js'

@fangzhouxin
Copy link

fangzhouxin commented Aug 24, 2016

I have the same problem with @liutopsec , I used docker to run gitbook serve command. There is no problem with version 2.6.7, and v3.0.x, v3.1.x, v3.2.x has this problem.

@yeszao
Copy link

yeszao commented Aug 25, 2016

I had same problem with nodejs 0.10.46 on linux. But everything was fine when I switch to windows and build with Nodejs 4.5.0

@kuake
Copy link

kuake commented Sep 2, 2016

the same problem on windows 7
node v6.3.1
GitBook version is 3.2.0

@lesstif
Copy link

lesstif commented Sep 2, 2016

i had same error on windows 7.

  • node v4.5.0
  • gitbook 3.2.0

@dstelljes
Copy link

Same error on Fedora. Seems (for me, at least) that it's caused by disk latency: My working directory is on a network drive, but when I build in /tmp (local) there are no problems.

@zargex
Copy link

zargex commented Sep 19, 2016

I think the same @dstelljes, in my case my home is imported from a NFS server and (like you) working in local folder there are no problems.

@zhilidali
Copy link

I had same error on windows 7.

  • node v4.5.0
  • gitbook 3.2.0

Is it because of NVM cause?

@hfxu
Copy link

hfxu commented Sep 22, 2016

Updated. Sorry for this approach seems not working.


I had same problem with gitbook build or serve command.And I found that the default search plugin lunr may caused error.
At last,I had add swiftype plugin to sovle this problem.
Here is the config of my book.json.

{
   "plugins": [
      "swiftype"
   ],
   "pluginsConfig": {
      "swiftype": {
         "token": "utQHy1R2XyiVqDqaZxxx",
         "version": "2.0.0"
      }
   }
}

You need to run gitbook install command to install the plugin before build your books.

My env:

  • Node 4.5.0
  • gitbook 3.2.0
  • npm 2.15.9

~~I hope this would help you.~~~~

@hfxu
Copy link

hfxu commented Sep 22, 2016

Updated. Sorry for this approach seems not working.


Just now,I found it would be a problem of npm's config probelm.I found the solution at the http://stackoverflow.com/questions/34600932/npm-eperm-operation-not-permitted-on-windows.There is no need to add additional plugins.
Here is the quote from the anwser:

1. Run cmd as administrator
2. Run npm config edit (You will get notepad editor)
3. Change Prefix variable to 'C:\Users<User Name>\AppData\Roaming\npm'

This works fine for me.

@zargex
Copy link

zargex commented Sep 22, 2016

Hi @hfxu, i tried your solution and saddly didn't work for me.

@ouweiya
Copy link

ouweiya commented Sep 26, 2017

After a few days of trying, I finally solved this problem!

You only need to reduce the version number and node.js version to solve the problem of failure to start and refresh the interrupt.

I did a lot of testing and found that the previous version of 3.0.0 did not have these problems, and node.js was V6.
It can be solved.

I recommend using: 2.6.7 ~ 2.6.4

You add a line in book.json:

{
    "gitbook" : "2.6.7"
}

Node.js: V6

$ node -v
v6.11.3

then

install:

$ gitbook install

run:

gitbook serve

I tested the version:

Recommended: 2.6.7 ~ 2.6.4

$ gitbook ls 
GitBook Versions Installed:
      3.2.3
      3.1.1
      3.1.0
      3.0.3
      3.0.0
      2.6.7
      2.6.6
      2.6.4
      2.3.2
      2.1.0

I am not a javascript expert, I can only use this stupid method to solve the problem, I sincerely hope to help you!

@Carson126
Copy link

Carson126 commented Oct 12, 2017

I get the same error. I have few times(less than 0.1%) works well after run as administrator and
npm cache clean
I've tried gitbook version 2.6.7. it seems work well and cannot be using the graceful-fs module.
how to use gitbook 3.x.x for win10. thanks a lot

@obogobo
Copy link

obogobo commented Oct 12, 2017 via email

@mericahero
Copy link

In windows use administrator then run the command, you will resolve the issue.

zlargon added a commit to zlargon/git-tutorial that referenced this issue Nov 17, 2017
@adamlesniak
Copy link

In my case installing gitbook as a package in the actual project folder was the solution.

This error was appearing when using gitbook-cli

@jppampin
Copy link

Thank you @bluedusk!! Your tip works like a charm.
OS: Win7
GitBook version is 3.2.3
Nodejs: v8.9.1

Steps:

  1. Edit file: C:\Users[user].gitbook\versions\3.2.3\lib\output\website\copyPluginAssets.js
  2. Modify in two places copyAssets(output, plugin) and copyResources(output, plugin), the line:
            confirm: true

by

            confirm: false

@daniele-orlando
Copy link

Same error but on MacOS and symbolic links.

@liuzhenrain
Copy link

@obogobo thank you....

@wayward-man
Copy link

node 8 + , npm 4+ ,gitbook 3.2.3 ,they seems to be lastest,but this problem still appear to my env.

@wayward-man
Copy link

can you see my problem ?sir

@flyyang
Copy link

flyyang commented Jul 9, 2018

any update on this, i don't want change the file manually...

yumikataoka added a commit to yumikataoka/gitbook that referenced this issue Jul 10, 2018
@thiagocaiubi
Copy link

thiagocaiubi commented Jul 11, 2018

So it's been a while and the bug is still alive. I could see some effort to close this issues within pull requests but sadly without approval. Sincerely, I stopped digging to understand why.

I came up with this simple Dockerfile as you might also want to use:

FROM node:8.11-alpine

RUN npm install --global gitbook-cli && \
    gitbook fetch 3.2.2 && \
    gitbook install && \
    npm cache clear --force && \
    rm -rf /tmp/*

# Fixes https://github.com/GitbookIO/gitbook/issues/1309
RUN sed -i.bak 's/confirm: true/confirm: false/g' \
    /root/.gitbook/versions/3.2.2/lib/output/website/copyPluginAssets.js

Build the image:

$ docker build . -t gitbook

Write README.md example:

$ echo "# Hello Gitbook" > README.md

Build a book:

$ docker run -v $(pwd):/gitbook -w /gitbook --rm -it gitbook gitbook build . output

@flyyang
Copy link

flyyang commented Jul 13, 2018

Seems the code was merged, when a new release will be published?

@Simran-B
Copy link

The official repository is dead.

@sam-falvo
Copy link

Sure seems that way. The commercial website indicates that they're on Gitbook v2 as of February 2018, which means, despite the semantic versioning of this package, this is all under the Gitbook v1 umbrella.

Guess it's time to move on to other tools. Back to LaTeX2html, I guess. ;-P

@lzhou1110
Copy link

Checked out the latest beta version solved this issue for me.

Use the below command to list all available versions:
gitbook ls-remote

Then I installed pre-release 4.0.0-alpha.6
gitbook fetch 4.0.0-alpha.6

See the GitHub repo for more details:
https://github.com/GitbookIO/gitbook/blob/master/docs/setup.md

@cyanTao
Copy link

cyanTao commented Nov 20, 2018

I had fixed it by restarting my computer. @everybody

@Simran-B
Copy link

@15766273878 It can occur randomly any time again. I doubt rebooting is a permanent solution for anything, ever.

@LawEric
Copy link

LawEric commented Dec 27, 2018

Sadly,I get the same error.

  • win 10

  • gitbook 3.2.3

  • node 10.14.1

Error: ENOENT: no such file or directory, stat 'F:\cmp2.0\doc\blueking_book\gitbook\gitbook-plugin-toggle-chapters\toggle.css'

@aallbrig
Copy link

@thiagocaiubi Thanks! I added...

# Fixes https://github.com/GitbookIO/gitbook/issues/1309
RUN sed -i.bak 's/confirm: true/confirm: false/g' \
    /root/.gitbook/versions/3.2.2/lib/output/website/copyPluginAssets.js

... to my Dockerfile and all works great now.


@Simran-B (@sam-falvo ?) Do you know why gitbook decided to deprecate gitbook-cli?

@rafecolton
Copy link

rafecolton commented Feb 8, 2019

I am getting this error too.

@lzhou1110 I did this and it immediately failed on the next rebuild.

EDIT: @thiagocaiubi's solution worked:

sed -i.bak 's/confirm: true/confirm: false/g' ~/.gitbook/versions/3.2.3/lib/output/website/copyPluginAssets.js

@aleung
Copy link

aleung commented Mar 25, 2019

My fork @aleung/gitbook implemented the fix: https://github.com/aleung/gitbook

@cyanTao
Copy link

cyanTao commented Mar 25, 2024 via email

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

No branches or pull requests