GitbookIO / gitbook-cli

GitBook's command line interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forcing a specific version of gitbook using --gitbook throws errors

detj opened this issue · comments

Trying gitbook build ./docs --gitbook=2.0.0, throws the following error

Error loading version latest: Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (module.js:557:15)
    at Function.Module._load (module.js:484:25)
    at Module.require (module.js:606:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:31:26
    at Object.<anonymous> (/Users/detj/.gitbook/versions/2.0.0/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)

TypeError: Cannot read property 'commands' of null

I do have the 2.0.0 version installed using gitbook fetch 2.0.0.

Running gitbook ls returns

$ gitbook ls
GitBook Versions Installed:

    * 3.2.3
      2.0.0

Run "gitbook update" to update to the latest version.

Also, the --gitbook option doesn't show up in gitbook help under the build sub-command. Is build the only command that accepts --gitbook option?

my gitbook version

$ gitbook --version
CLI version: 2.3.2
GitBook version: 3.2.3

same behaviour if the forced version doesn't exist & it fetches the version first. In this case, it fetches the version but throws the same error as above.

$ gitbook build --gitbook=2.0.0
Installing GitBook 2.0.0
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:85:
../src/methods.cc:14:12: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  handler->Call(3, argv);
           ^
../node_modules/nan/nan.h:1567:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../node_modules/nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node
gitbook@2.0.0 ../../../../../var/folders/4m/smjxkswn06v7xm6qplmrszqr0000gn/T/tmp-54825jEibmEN641Cd/node_modules/gitbook
├── bash-color@0.0.3
├── nunjucks-filter@0.1.0
├── gitbook-plugin-livereload@0.0.1
├── nunjucks-autoescape@0.1.1
├── spawn-cmd@0.0.2
├── q@1.0.1
├── graceful-fs@3.0.5
├── URIjs@1.14.1
├── crc@3.2.1
├── tmp@0.0.24
├── semver@2.2.1
├── dom-serializer@0.1.0 (domelementtype@1.1.3, entities@1.1.1)
├── nunjucks-i18n@1.0.0 (lodash@2.4.1)
├── npmi@0.1.1 (semver@4.3.6)
├── resolve@0.6.3
├── send@0.2.0 (fresh@0.2.4, range-parser@1.0.3, mime@1.2.11, debug@3.1.0)
├── gaze@0.5.2 (globule@0.1.0)
├── request@2.51.0 (forever-agent@0.5.2, tunnel-agent@0.4.3, aws-sign2@0.5.0, caseless@0.8.0, oauth-sign@0.5.0, stringstream@0.0.5, json-stringify-safe@5.0.1, mime-types@1.0.2, qs@2.3.3, node-uuid@1.4.8, tough-cookie@2.3.4, combined-stream@0.0.7, http-signature@0.10.1, form-data@0.2.0, hawk@1.1.1, bl@0.9.5)
├── fs-extra@0.16.5 (jsonfile@2.4.0, rimraf@2.6.2)
├── tiny-lr@0.1.5 (parseurl@1.3.2, livereload-js@2.3.0, qs@2.2.5, debug@2.0.0, body-parser@1.8.4, faye-websocket@0.7.3)
├── lunr@0.5.7
├── fstream-ignore@1.0.2 (inherits@2.0.3, minimatch@2.0.10, fstream@1.0.11)
├── cheerio@0.19.0 (entities@1.1.1, css-select@1.0.0, htmlparser2@3.8.3)
├── highlight.js@8.4.0
├── lodash@3.5.0
├── gitbook-parsers@0.7.2 (q@1.5.1, gitbook-restructuredtext@0.2.3, gitbook-markdown@0.4.1, gitbook-asciidoc@0.2.3)
├── npm@2.4.1
└── nunjucks@1.2.0 (optimist@0.6.1, chokidar@0.12.6)
Error loading version latest: Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (module.js:557:15)
    at Function.Module._load (module.js:484:25)
    at Module.require (module.js:606:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:31:26
    at Object.<anonymous> (/Users/detj/.gitbook/versions/2.0.0/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)

TypeError: Cannot read property 'commands' of null

same problem.

node -v
v10.14.1

npm -v
6.4.1

gitbook -V
CLI version: 2.3.2
GitBook version: 2.5.2


gitbook install failed immediatly

Error loading version latest: Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at evalmachine.<anonymous>:44:31
    at Object.<anonymous> (C:\Users\Administrator.SKY-20170327BBW\.gitbook\versions\2.5.2\node_modules\graceful-fs\fs.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)

TypeError: Cannot read property 'commands' of null

I've tried to clean and install node 10 from 8 with no luck..

It can be solved I run command of gitbook fetch 3.2.2.