0 x01: overture
The author installed the GitBook from muddled to getting started method in this article and configured the GitBook environment on the M1 version of MacBookAir.
In: gitbook init
TypeError: cb. Apply is not a function
Installing GitBook 3.2.3 SOLINK_MODULE (target) Release /. Node CXX (target) Release/obj. Target/fse/fsevents. O SOLINK_MODULE(target) Release/fse.node SOLINK_MODULE(target) Release/.node CXX(target) Release/obj.target/fse/fsevents.o SOLINK_MODULE(target) Release/fse.node /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287
if (cb) cb.apply(this, arguments)
^
TypeError: cb.apply is not a function
at /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
at FSReqCallback.oncomplete (fs.js:184:5)
Copy the code
Note the key information: TypeError: cb.apply is not a function at /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
0 x02: history
Refer to this post: www.cnblogs.com/cyxroot/p/1…
Modify the contents of key information files:
sudo vim /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js
Copy the code
Modify the content: 62-64
fs.stat = statFix(fs.stat)
fs.fstat = statFix(fs.fstat)
fs.lstat = statFix(fs.lstat)
Copy the code
Comment it out and change it to:
//fs.stat = statFix(fs.stat)
//fs.fstat = statFix(fs.fstat)
//fs.lstat = statFix(fs.lstat)
Copy the code
Now run: gitbook init
Another error was reported:
warn: no summary file in this book
info: create SUMMARY.md
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Promise
Copy the code
Reference here: stackoverflow.com/questions/6…
I have the same problem just as you. Switch back from latest node version to 12.18.1 LTS.
And everything gonna be ok.
Therefore, I try to downgrade node: v14.16.1 -> v12.22.1
You can find the V12 version here: nodejs.org/dist/latest…
I used the MacBookAir, download this: nodejs.org/dist/latest… To install the software. Then reinstall
Now run: gitbook init, no more error:
info: create SUMMARY.md
info: initialization is finished
Copy the code
Gitbook PDF././my.pdf
InstallRequiredError: "ebook-convert" is not installed.
Install it from Calibre: https://calibre-ebook.com
Copy the code
Follow the instructions to download and install the system version software from Calibre-ebook.com. The author can download it from download.calibre-ebook.com/5.16.1/cali…
Configuration ebook – convert path reference: caibaojian.com/gitbook/bui…
To add a PATH configuration, first open this file:
sudo vim ~/.zshrc
Copy the code
To add a path, add a code:
export PATH="/Applications/calibre.app/Contents/MacOS:$PATH"
Copy the code
Activate this file after saving:
source ~/.zshrc
Copy the code
At this point, the ebook-convert command is tested, and the command line executes: ebook-convert
Output:
Usage: ebook-convert input_file output_file [options] Convert an e-book from one format to another. input_file is the input and output_file is the output. Both must be specified as the first two arguments to thecommand.
The output e-book format is guessed from the file extension of output_file. output_file can also be of the special format .EXT where EXT is the output file extension. In this case. the name of the output file is derived from the name of the input file. Note that the filenames must not start with a hyphen. Finally,if output_file has no extension, then it is treated as a folder and an "open e-book"(OEB) consisting of HTML files is written to that folder. These files are the files that would normally have been passed to the output plugin. After specifying the input and output file you can customize the conversion by specifying various options. The available options depend on the input and output file types. To gethelp on them specify the input and output file and then use the -h option.
For full documentation of the conversion system see
https://manual.calibre-ebook.com/conversion.html
Whenever you pass arguments to ebook-convert that have spaces in them, enclose the arguments in quotation marks. For example: "/some path/with spaces"
Options:
--version show program's version number and exit -h, --help show this help message and exit --list-recipes List builtin recipe names. You can create an e-book from a builtin recipe like this: ebook-convert "Recipe Name.recipe" output.epub Created by Kovid Goyal
@kovidgoyal.net>Copy the code
At this point, ebook-convert has been installed and tested, and the PDF books can be exported as follows: gitbook PDF././my.pdf
Output:
info: 7 plugins are installed
info: 6 explicitly listed
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 9 pages info: found 0 asset files info: >> generation finished with successin 14.0s !
info: >> 1 file(s) generated
Copy the code
0 x03: postscript
This blog for your useful words welcome to collect and forward, but also trouble lovely and love to learn you can appreciate a praise, food song more bo is not easy, thank you here.
If you want to learn more development skills and AI algorithms, please search our official account “Concise AI”, and learn with your friends who love learning and discussing.