GithubHelp home page GithubHelp logo

Comments (19)

jzaefferer avatar jzaefferer commented on June 19, 2024

I have no idea why I was using "#!/bin/evn node" in the first place, replacing that seems fine. Just to be sure: Did the issue only occur when running the commit hook, or already during installation of the npm package? Your description seems to indicate the latter, but I don't understand why that line would cause an issue during installation.

from commitplease.

rxaviers avatar rxaviers commented on June 19, 2024

Using #!/usr/local/bin/node is not cross-OS compatible, because you don't know where node is installed in someone's OS.

from commitplease.

jzaefferer avatar jzaefferer commented on June 19, 2024

To verify the suggested (or other) solutions work, you can check out the repo, patch the one line, then use npm install path/to/checkout to do an install from the checkout (don't use npm-link, that doesn't work here).

from commitplease.

arschmitz avatar arschmitz commented on June 19, 2024

we should dynamically generate this path with process.execPath

from commitplease.

jzaefferer avatar jzaefferer commented on June 19, 2024

http://stackoverflow.com/questions/20638520/appropriate-hashbang-for-node-js-scripts says that #!/usr/bin/env node is the right hashbang for node, which is currently in use.

I'm still not sure what the actual issue is, since this file isn't executed while installing.

from commitplease.

jzaefferer avatar jzaefferer commented on June 19, 2024

The install script in package.json just references node: https://github.com/jzaefferer/commitplease/blob/master/package.json#L7 - if that isn't in your path, it won't work, but there's nothing about a hashbang going on there.

from commitplease.

scottgonzalez avatar scottgonzalez commented on June 19, 2024

@jzaefferer is correct. #!/user/bin/env node is the correct shebang line to have in the commit hook, and the shebang line doesn't even come into play on install. So based on the details in this bug report, there is nothing to change inside commitplease.

from commitplease.

arschmitz avatar arschmitz commented on June 19, 2024

I talked to @ipaintcode about this last night the problem is on commit not on install. but still not sure whats going on since #!/user/bin/env node should work anywhere

from commitplease.

arschmitz avatar arschmitz commented on June 19, 2024

even more interesting the grunt-cli uses this exact same shebang and works for them fine. There has to be something else going on here.

from commitplease.

arschmitz avatar arschmitz commented on June 19, 2024

This is an issue with sourcetree and commit hooks https://answers.atlassian.com/questions/140339/sourcetree-hook-failing-because-paths-don-t-seem-to-be-set-correctly

from commitplease.

ipaintcode avatar ipaintcode commented on June 19, 2024

Looks like @arschmitz found the culprit, a big thanks to everyone (thanks again @arschmitz) for checking into this. I did do a fresh install on notebook and seems to have fixed the issue. It was a very weird one off that seemed to be breaking unless I changed the #! to the ladder I posted.

from commitplease.

arschmitz avatar arschmitz commented on June 19, 2024

I did a little more looking into this and it turns out this is kind of a real issue. It actually prevents the usage of commit please using any OSX App like the github client, source-tree, sublime git plugin, atom git plugin etc. Basically OSX apps don't have access to the PATH

Im really really surprised this has not come up previously on one of the jQuery projects

from commitplease.

jzaefferer avatar jzaefferer commented on June 19, 2024

@arschmitz could you provide some steps to reproduce with one of those apps?

from commitplease.

mgol avatar mgol commented on June 19, 2024

@jzaefferer Steps are as follows:

  1. Make sure you're on the latest El Capitan (10.11.3)
  2. Uninstall Node.js
  3. Install nvm
  4. Install any Node version using nvm, e.g. nvm install 5
  5. Try to use commitplease from the terminal (e.g. by commiting in the jQuery repo), it works
  6. Install SourceTree, add the jQuery repo to bookmarks, open it & try to commit

It won't find Node as the PATH it sees is only /usr/bin:/bin:/usr/sbin:/sbin.

from commitplease.

mgol avatar mgol commented on June 19, 2024

Hardcoding the PATH would have its own problems, though (jquery/jquery#2915). Currently the jQuery repo uses both husky & commitplease so gets the worst of both as both problems exist. :-)

from commitplease.

jzaefferer avatar jzaefferer commented on June 19, 2024

Thanks for the steps. I wonder if you could create a symbolic link in /usr/bin, pointing at nvm's default node version (set with nvm alias default ...). That way SourceTree should be able to find the node binary, and it updates as you change your default alias.

from commitplease.

mgol avatar mgol commented on June 19, 2024

I wonder if you could create a symbolic link in /usr/bin

I can't. El Capitan's System Integrity Protection prevents you from writing to most system directories, including those 4 ones that are in the PATH for GUI apps. Even root can't do that.

from commitplease.

arschmitz avatar arschmitz commented on June 19, 2024

We originally ran into this at my company the work around we settled on is documenting that if you use a GUI for committing to open the commit hook and set the path manually. Since this is within the .git folder it will remain untouched even when reinstalling etc. we thought about submitting a PR for other solutions but felt they all had other significant draw backs as discussed in jquery/jquery#2915

I would just add a note to the documentation about GUI apps and how to fix them and about updating if you bump node versions.

Just thinking out loud but maybe we could add a command to do this for the user not real sure about the post install thing so this might be a middle ground

from commitplease.

jzaefferer avatar jzaefferer commented on June 19, 2024

Can't tell if this is still an issue, since its been a year, I'm closing.

from commitplease.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.