Comments (19)
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.
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.
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.
we should dynamically generate this path with process.execPath
from commitplease.
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.
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.
@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.
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.
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.
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.
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.
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.
@arschmitz could you provide some steps to reproduce with one of those apps?
from commitplease.
@jzaefferer Steps are as follows:
- Make sure you're on the latest El Capitan (10.11.3)
- Uninstall Node.js
- Install nvm
- Install any Node version using nvm, e.g.
nvm install 5
- Try to use commitplease from the terminal (e.g. by commiting in the jQuery repo), it works
- 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.
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.
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.
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.
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.
Can't tell if this is still an issue, since its been a year, I'm closing.
from commitplease.
Related Issues (20)
- [Bug] Husky hook erroring out HOT 7
- Optionally disallow "WIP", "Merge" ( and fixup! / squash!) HOT 3
- fixup! and squash! docs do not reflect actual behavior HOT 4
- scope required when it should be optional HOT 4
- Join forces with commitlint? HOT 8
- getProjectPath fails on Travis CI HOT 5
- Skip links for the length rule HOT 5
- Allow users to provide his own configuration
- Allow skipping of hook at install time HOT 1
- Allow Revert commits
- Support other presets?
- Should work with any of GitHub's closing keywords HOT 2
- Fail softer when not a git repo/no commits in git repo HOT 2
- Improve feedback flow HOT 10
- Generic Commit message pattern HOT 9
- Hook does not display errors HOT 11
- Using a word containing a keyword breaks the validation HOT 4
- Subsequent `git commit -m` get swallowed and ignored
- Display my own guidelines URL HOT 3
- [Request] Support skipping certain lines being linted for line length HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commitplease.