Cannot build using GitBook framework preset

Hi there,
I was trying to create my cf pages by importing from my GitHub repo, and I used GitBook as the framework preset.
However, the build failed with some error logs as below:

|2024-05-13T04:42:37.010247Z|Cloning repository...|
|---|---|
|2024-05-13T04:42:40.494144Z|From https://github.com/xxxxxxxxxx/xxxxxxxxx|
|2024-05-13T04:42:40.494698Z| * branch            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -> FETCH_HEAD|
|2024-05-13T04:42:40.494796Z||
|2024-05-13T04:42:40.817045Z|HEAD is now at xxxxxxx GitBook structuring (done.)|
|2024-05-13T04:42:40.817558Z||
|2024-05-13T04:42:40.904041Z||
|2024-05-13T04:42:40.904567Z|Using v2 root directory strategy|
|2024-05-13T04:42:40.934574Z|Success: Finished cloning repository files|
|2024-05-13T04:42:42.640078Z|Checking for configuration in a wrangler.toml configuration file (BETA)|
|2024-05-13T04:42:42.640657Z||
|2024-05-13T04:42:42.72762Z|No wrangler.toml file found. Continuing.|
|2024-05-13T04:42:42.879255Z|Detected the following tools from environment: |
|2024-05-13T04:42:42.880339Z|Executing user command: npx gitbook-cli build|
|2024-05-13T04:42:44.486057Z|npm WARN exec The following package was not found and will be installed: [email protected]|
|2024-05-13T04:42:51.33513Z|Installing GitBook 3.2.3|
|2024-05-13T04:43:09.806291Z|/opt/buildhome/.npm/_npx/422dd78afe158fd7/node_modules/npm/node_modules/graceful-fs/polyfills.js:287|
|2024-05-13T04:43:09.806658Z|      if (cb) cb.apply(this, arguments)|
|2024-05-13T04:43:09.806847Z|                 ^|
|2024-05-13T04:43:09.806982Z||
|2024-05-13T04:43:09.80709Z|TypeError: cb.apply is not a function|
|2024-05-13T04:43:09.807208Z|    at /opt/buildhome/.npm/_npx/422dd78afe158fd7/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18|
|2024-05-13T04:43:09.807362Z|    at FSReqCallback.oncomplete (node:fs:211:5)|
|2024-05-13T04:43:09.80744Z||
|2024-05-13T04:43:09.807564Z|Node.js v18.17.1|
|2024-05-13T04:43:09.850271Z|Failed: Error while executing user command. Exited with error code: 1|
|2024-05-13T04:43:09.863954Z|Failed: build command exited with code: 1|
|2024-05-13T04:43:10.945786Z|Failed: error occurred while running build command|

I don’t think it’s my problem, as the same repo was built successfully on GitBook.com. Could anyone help me to solve this problem and create pages successfully? I would be appreciate.

Solved by setting the environment variable NODE_VERSION to 10.24.1, because GitBook CLI was deprecated and the highest Nodejs version compatible with it is 10.x.x.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.