FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Latest Nodegit build is broken · Issue #1044 · nodegit/nodegit · GitHub

Repository navigation

Latest Nodegit build is broken #1044

Description

I just started to play with nodegit, but I cant use it at all. Calling Repository.init command will die silently (no console output).

"Cannot find module './blame_hunk'"

Inspecting the app shows that its die while trying to load the modules in nodegit/dist/nodegit.js like the blame_hunk module. For different calls I get different errors.

I am using osx.

Activity

  1. NoNameProvided commented on May 30, 2016

    Author

    SImple example app demonstrating the issue:

    //package.json
    {
      "name": "gitnodetest",
      "version": "1.0.0",
      "description": "",
      "main": "test.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "Test Joe",
      "license": "MIT",
      "dependencies": {
        "nodegit": "0.13.0"
      }
    }
    //test.js
    var NodeGit = require("nodegit");
    var path = require('path');
    var promisify = require("promisify-node");
    var fse = promisify(require("fs-extra"));
    
    NodeGit.Repository.init(path.resolve(`${__dirname}/tmp/`, 'testRepo'), 0).then(
        (repo) => {
            fse.writeFile(path.join(repo.workdir(), 'test.txt'), 'content').then(() => {
                repo.refreshIndex().then(index => {
                    index.addByPath(path.join(repo.workdir(), 'test.txt')).then(() => {
                        index.write();
                    })
                });
            }) 
        },
        () => console.log('fail')
    );  

    Running this will throw an error in module.js:442 "Cannot find module './annotated_commit'" Going down in the stack trace I can see the issue is require is called from nodegit/dist/nodegit.js:746 when this line is called: importExtension("annotated_commit");

  2. changed the title [-]Cant use nodegit[/-] [+]Latest Nodegit build is broken[/+] on May 31, 2016
  3. gjtorikian commented on Jun 5, 2016

    NodeGit 0.13.1 needs to be placed onto npm: bdf9c68

    The core issue was fixed: #1026

    /cc @johnhaley81

  4. johnhaley81 commented on Jun 5, 2016

    Collaborator

    Whoops... thanks @gjtorikian. I'm publishing now.

  5. gjtorikian commented on Jun 5, 2016

    Thanks for the quick reply! 😻

  6. johnhaley81 commented on Jun 8, 2016

    Collaborator

    @NoNameProvided is this fixed for you now?

  7. NoNameProvided commented on Jun 12, 2016

    Author

    Hmm, just rerun this test case, and it still throw exceptions under the hood. ("Cannot find module './annotated_commit'") I am not sure tho if this is expected (and handled) or not. After running this test snippet a git repo is initialized but the file is not added to the index, its untracked.

  8. johnhaley81 commented on Jun 23, 2016

    Collaborator

    @NoNameProvided I just published NodeGit 0.14.0. Can you see if that fixes this issue for you?

  9. maxkorp commented on Jul 13, 2016

    Collaborator

    Other people with similar issues are seeing this kind of thing fixed in latest. Closing this, if it's still broken for you, let us know and we'll reopen

  10. ashleydw commented on Mar 6, 2017

    Sorry for dragging up an old thread, but is it expected that some internal extensions are missing?

    I can build via postinstall just fine, but looking at the source an importExtension("annotated_commit"); call is made to require the file annotated_commit. I don't have this file, but the exception is swallowed in a try/catch statement. Should I have it? If not, why include it, and if so, where's my file and why is the exception swallowed?

    Building for electron if it makes a difference. I also miss things like nodegit.Reset.TYPE - it doesn't exist on that type. (using electron remote require)

  11. rcjsuen commented on Mar 9, 2017

    Member

    @ashleydw The extensions that are "provided" are listed in the lib/ folder. I don't know if I'd really call them "extensions" but anyway, they're all in there. If one doesn't exist, that's perfectly normal. Not every wrapped API has extra pure JavaScript code added to it.

    As to your second problem, I don't really understand what is going on. Perhaps you could provide some additional information like code and error messages and so on and so forth?

  12. ashleydw commented on Mar 14, 2017

    OK, now I understand regarding extensions. I see in the generator that there is no check regarding if they should exist and it adds all - hence the try/catch and swallow of the exception (

    var importExtension = function(name) {
    ).


    Regarding my second part, in electron:

    const remote = require('electron').remote;
    const nodegit = remote.require('nodegit');
    const reset = nodegit.Reset;
    console.log(reset, reset.TYPE);
    

    Results in

    So it seems the extensions (https://github.com/nodegit/nodegit/blob/97ff2cdde471659bb158400c757815e4d48ba2ff/lib/reset.js) aren't being added to my object; they are being swallowed in the try/catch in the generator.

    Edit: By adding console.log's throughout the code, I can see the extensions do get loaded in the initial load but not via electron's remote require. I guess my problem is there :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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


      Back | FazBrowse Home | New Git URL