gitbook-cli icon indicating copy to clipboard operation
gitbook-cli copied to clipboard

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

Open detj opened this issue 7 years ago • 3 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

detj avatar Mar 04 '18 10:03 detj

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
[email protected] ../../../../../var/folders/4m/smjxkswn06v7xm6qplmrszqr0000gn/T/tmp-54825jEibmEN641Cd/node_modules/gitbook
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected]
└── [email protected] ([email protected], [email protected])
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

detj avatar Mar 04 '18 10:03 detj

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..

ghost avatar Dec 03 '18 03:12 ghost

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

yt46767 avatar Jul 30 '19 03:07 yt46767