Skip to content

Trying to use this in a global package but having issues with permissions #118

@chopfitzroy

Description

@chopfitzroy

I have the following script, which I have installed globally:

#!/usr/bin/env node

const path = require('path');
const yargs = require('yargs').argv;
const ghpages = require('gh-pages');

ghpages.publish(path.join(process.cwd(), './dist'), {
  branch: 'master'
}, err => {
  console.log(err, process.cwd());
});

I am getting the following error:

{ ProcessError: fatal: could not create work tree dir '../../../../usr/lib/node_modules/gh-deploy-extended/node_modules/gh-pages/.cache': Permission denied

    at ChildProcess.<anonymous> (/usr/lib/node_modules/gh-deploy-extended/node_modules/gh-pages/lib/git.js:47:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:492:12)
  code: 128,
  message: 'fatal: could not create work tree dir \'../../../../usr/lib/node_modules/gh-deploy-extended/node_modules/gh-pages/.cache\': Permission denied\n',
  name: 'ProcessError' } '/home/otis/Developer/portfolio'

If I add the following option: clone: '/tmp/gh-pages' I stop getting permission errors and get the following:

{ Error: ENOENT: no such file or directory, mkdir ''
    at Error (native) errno: -2, code: 'ENOENT', syscall: 'mkdir', path: '' } '/home/otis/Developer/portfolio'

Any ideas?
Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions