GitBook edits documents

When companies use common components, they suffer from poor documentation and have to look at the code every time they call them. So I want to write my own components to let others do not so pit, but also convenient to view their own convenience, so I plan to write for their own development of the document development document. Then I realized that GitBook was a great tool for writing development documents, so… Indicates to the document:

The installation

	npm install gitbook-cli -g
Copy the code

You know it’s scaffolding when you see the CLI, right?! Yes, Gitbook – CLI is the program to install and manage the Gitbook version library. It automatically installs the modules required by GitBook to create a book.

create

	gitbook init
    
    // Create a book using an existing directory
    gitbook init ./dirctory
Copy the code

Run and pack

	gitbook serve
    
    gitbook build
Copy the code

Just like any other scaffold

Install other versions

The gitbook command makes it easy to download and install different versions of Gitbook to test your book

	gitbook fetch 4.0. 0-alpha1.
Copy the code

Use gitbook ls-remote to list the remote versions available for installation

	$ gitbook ls-remote
    Available GitBook Versions:

     4.0. 0-alpha. 5. Part of... .4.0. 0-alpha1..3.22..3.21.. Part of... .2.0. 0-alpha1.

Tags:

     latest : 3.22.
     pre : 4.0. 0-alpha. 5
Copy the code

However…

After operating like a tiger…

Error!!!!

It’s embarrassing… All steps are in accordance with the official website tutorial ah, why the error?

So, you can only go to Baidu Google: some people say that this is because you use too high version of Node, GitBook is not compatible with the cause of the node version.

Won’t you? I can’t release Node for such a “personal” project, can I? What about my other “serious” projects?

At this moment a word flashed through my mind NVM, right ah, how to forget this thing?

nvm

This is exactly what NVM exists for. Node.js Version Management is node.js version Management. It allows you to install and switch between different versions of NodeJS on a single computer.

Download and install without delay…

And then:

	nvm ls-remote // Lists all installable Node versions
    nvm install v1218.3. // Install the specified version of Node
    nvm use v1218.3. // Switch the node version, which is global
    nvm current // The current node version
    nvm ls // Lists all installed Versions of Node
Copy the code

Tried it with version 12.18.3 first, same as before

	if(cb) cb.apply(this.arguments)
    
    TypeError: cb.apply is not a function
Copy the code

Also not line? And some netizens say that may need to use 10. Xx. Xx version, it seems that many friends have been troubled by this problem!

Well, I’ll have to try again.

NVM install 10.21.0 + NVM use v10.21.0

At this time to use gitbook serve, a http://localhost:4000 website is vividly displayed in front of me.