node.js - "Arguments to path.resolve must be strings" when calling 'gitbook build' from a Git hook -


i trying run gitbook build within post-receive git hook on (gitlab, debian 7, virtual private) server.

basically want to:

  • checkout bare repository temporary dir
  • run gitbook build in temporary dir
  • sync webspace through rsync

the post-receive script runs like:

git --work-tree=/home/git/temp-checkout / --git-dir=/home/git/repositories/my/repo.git checkout -f  gitbook build /home/git/temp-checkout  rsync ... 

running these commands server's command line works perfectly.
running script server's command line works too.
when script invoked git hook gitbook call produces following error:

remote: path.js:439 remote:       throw new typeerror('arguments path.resolve must strings'); remote:             ^ remote: typeerror: arguments path.resolve must strings remote:     @ object.posix.resolve (path.js:439:13) remote:     @ object.<anonymous> (/usr/lib/node_modules/gitbook-cli/lib/config.js:5:24) remote:     @ module._compile (module.js:460:26) remote:     @ object.module._extensions..js (module.js:478:10) remote:     @ module.load (module.js:355:32) remote:     @ function.module._load (module.js:310:12) remote:     @ module.require (module.js:365:17) remote:     @ require (module.js:384:17) remote:     @ object.<anonymous> (/usr/lib/node_modules/gitbook-cli/bin/gitbook.js:11:14) remote:     @ module._compile (module.js:460:26) 

searching error message seems point grunt, have no idea happening here. suspected invocation/permissions, neither user (in both cases whoami returns git user) nor working directory seem make difference.

but in case gitbook behaves differently when invoked "locally" (i.e. server's command line) or git hook.

some further consideration brought me right direction: invoking git hook has different login context working on server's command line. running set > some-file in both contexts revealed significant differences in environment variables.

some experiments turned out was

export home=/home/git 

that had included in script. gitbook choked on not having environment variable set.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -