Skip to content

path.resolve issue when running gitbook from a Git hook #796

@uliska

Description

@uliska

I'm not sure if that's the place to write this, but I didn't find another place.
Actually I don't think it's an "issue" but a usage question, but please bear with me ...

I'm trying to run gitbook on my virtual private server (running Debian 7) to publish a book through a Git (Gitlab) hook.

The outline of hook/post-receive is

  • checkout the bare repository to a temp location
  • run gitbook build
  • use rsync to update the webspace
#!/bin/bash
# Checkout to temporary dir, run gitbook and upload to web space

git --work-tree=/home/git/thebook-checkout --git-dir=/home/git/repositories/thebook.git

gitbook build /home/git/thebook-checkout/

# rsync

When I run this script from the server's command line everything works well, but when it is called from the git hook it returns the following messages

remote: path.js:439
remote:       throw new TypeError('Arguments to path.resolve must be strings');
remote:             ^
remote: TypeError: Arguments to path.resolve must be strings
remote:     at Object.posix.resolve (path.js:439:13)
remote:     at Object.<anonymous> (/usr/lib/node_modules/gitbook-cli/lib/config.js:5:24)
remote:     at Module._compile (module.js:460:26)
remote:     at Object.Module._extensions..js (module.js:478:10)
remote:     at Module.load (module.js:355:32)
remote:     at Function.Module._load (module.js:310:12)
remote:     at Module.require (module.js:365:17)
remote:     at require (module.js:384:17)
remote:     at Object.<anonymous> (/usr/lib/node_modules/gitbook-cli/bin/gitbook.js:11:14)
remote:     at Module._compile (module.js:460:26)

So, what is it that is passed as a string when called locally but not when running from the git hook?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions