mbostock / gistup

Create a gist from terminal, then use git to update it.
Other
488 stars 41 forks source link

error: pathspec 'gistup' did not match any file(s) known to git #22

Open nswitanek opened 9 years ago

nswitanek commented 9 years ago

Hi,

I've followed the "Let's Make a Block" tutorial and gotten stuck trying to run gistup. I've pasted the error below, which isn't addressed in your gistup troubleshooting section. At first I thought it might be a git configuration issue, but it looks like I've not set up my path variables correctly for npm-installed programs to run. Will check that first.

Thank you.

c:\Users\username\AppData\Roaming\npm\node_modules\gistup\lib\gistup\unless.js:11
    throw error;
          ^
Error: Command failed: error: pathspec 'gistup' did not match any file(s) known to git.
error: pathspec 'commit.'' did not match any file(s) known to git.

    at ChildProcess.exithandler (child_process.js:637:15)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)
mbostock commented 9 years ago

This is almost certainly a Windows issue, and I’m afraid I won’t be much help at solving it. My guess from the cryptic error is that it’s failing inside the gitCommit function:

function gitCommit(callback) {
  child.exec("git commit --allow-empty -m 'Initial gistup commit.'", function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
    if (!error && stdout) process.stdout.write(stdout);
    callback(error);
  });
}

Specifically, it looks like your shell is not correctly parsing the single-quoted commit message (Initial gistup commit.) and is instead passing gistup and commit.' as separate arguments to git. Which of course fails.

It’s possible that gistup could be modified to support Windows, but my guess is that this would require substantial changes. So you might be out of luck. Sorry. :frowning:

nswitanek commented 9 years ago

Understood. Thanks very much for your swift reply.

CrandellWS commented 9 years ago

I can bypass the mentioned error https://github.com/mbostock/gistup/issues/22#issue-90510743 using underscores like so

function gitCommit(callback) {
  child.exec("git commit --allow-empty -m 'Initial_gistup_commit'", function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
    if (!error && stdout) process.stdout.write(stdout);
    callback(error);
  });
}
CrandellWS commented 9 years ago

Ok it is creating the Gist on GitHub in MINGW64 using https://github.com/mbostock/gistup/tree/c6f3b193de8a99f6275496ec2dd6761b57c3e598

CrandellWS commented 9 years ago

So a note to myself https://github.com/CrandellWS/gistup/commit/ac982d14359cc529f5bf01c58fd4f728952e501c from where I had not realized there was a problem with ssh (had not even tried yet, thought it was setup but do to custom naming convience...)

CrandellWS commented 9 years ago

Got this much figured out from https://gist.github.com/leommoore/4484379#passing-environment-variables

function gitTestWin(callback) {
  var env = process.env,
    varName,
    envCopy = {};
    // Copy process.env into envCopy
    for (varName in env) {
      envCopy[varName] = env[varName];
    }
    envCopy['wtf'] = 'It is a win thing';
    child.exec("echo %wtf%", { env: envCopy}, function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("It has failed.");
    if (!error && stdout) process.stdout.write(stdout);
    if(error){
      console.warn(error.message);
    }
    console.warn('EXIT');
    process.exit(1);
  });
}
CrandellWS commented 9 years ago

Cross platform??>

var env = process.env,
varName,
envArgv,
envCopy = {};
// Copy process.env into envCopy
for (varName in env) {
  envCopy[varName] = env[varName];
}
envCopy['wtf'] = 'It is a win thing';

if(process.platform === "win32") {
  envArgv = "%wtf%";
} else {
  envArgv = "$wtf";
}
child.exec("echo " + envArgv, { env: envCopy}, function(error, stdout, stderr) {
CrandellWS commented 9 years ago

Here is what I have got so far https://github.com/CrandellWS/gistup/commit/6114d26d98d70968176975b094f2af86d5e4973c

Though it looks like more can still be done.

CrandellWS commented 9 years ago

With Windows this works

function gitCommit(callback) {
  child.exec('git commit --allow-empty -m "Initial gistup commit"',function(error, stdout, stderr) {
      if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
      if (!error && stdout) process.stdout.write(stdout);
      callback(error);
  });
}

vs this fails

function gitCommit(callback) {
  child.exec("git commit --allow-empty -m 'Initial gistup commit.'", function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
    if (!error && stdout) process.stdout.write(stdout);
    callback(error);
  });
}

do not have current access to linux but it is assumed that there is reason to not just change it like mentioned if only because the message might contain unwanted character and what not...

CrandellWS commented 9 years ago

bit stuck on Right single quotation mark (U+2019) vs. Apostrophe (U+0027) not sure what to do

CrandellWS commented 9 years ago

deferred to

 child.exec('git config --get remote.' + crossPlatform.envVal('remoteName') + '.url || '+ crossPlatform.rEcho(),{ env: crossPlatform.newEnvVal('remoteName', argv.remote)}, function(error, stdout, stderr) {
CrandellWS commented 9 years ago

now you can see the rEcho (returned echo) in cross-platform.js this newer update partially works in MinGW and cmd.exe https://github.com/CrandellWS/gistup/commit/010814e68d97f9515c3870eafc417111ca295fed

still got the file issue to consider https://github.com/mbostock/gistup/issues/21

Can Someone test this on a linux system for me

CrandellWS commented 9 years ago

Windows users will hopefully find success using:

 npm install -g mkg
CrandellWS commented 9 years ago

The previous package was renamed to mkg so use npm install -g mkg to install.

Was able to get Ubuntu up and running to test the package and found it is now successfully working.

A side note for Ubuntu users getting npm running was not so straight forward. For my purposes the Best Solution To get npm working correctly on Ubuntu:

  1. Option 2 @ https://docs.npmjs.com/getting-started/fixing-npm-permissions
  2. Create soft link to nodejs for node in ~/bin -> ln -swhich nodejs~/bin/node
gilsedition commented 7 years ago

This issue is fixed with the solution CrandellWS provided. Thanks @CrandellWS