Comments (9)
fixed it by editing the file:
.git/hooks/pre-commit
to include the line:
. $HOME/.nvm/nvm.sh
for example:
#!/bin/bash
. $HOME/.nvm/nvm.sh
./node_modules/pre-commit/hook
RESULT=$?
[ $RESULT -ne 0 ] && exit 1
exit 0
from pre-commit.
I just solved this problem:
Install nodejs on Windows, then add a .bashrc
file in your home (C:/users/YOUR_PROFILE
) dir and add PATH=$PATH:/c/Program\ Files/nodejs
. That's it.
@3rd-Eden maybe you could add this info to the readme?
from pre-commit.
I also had the following issue:
git push origin && git push origin --tags && npm publish
.git/hooks/pre-push: line 8: dirname: command not found
.git/hooks/pre-push: line 8: /husky.sh: No such file or directoryerror: failed to push some refs to '[email protected]:bennyn/my-repository.git'
I fixed it by adding "C:\Program Files\Git\cmd" to my %PATH% system variable (Windows 10). My Git version is: 2.24.0.windows.2
from pre-commit.
Windows10 git bash setting environment variables can solve the problem.
$ vim ~/.bashrc
# add in .bashrc
PATH=$PATH:/c/Program\ Files\ \(x86\)/nodejs
from pre-commit.
I just faced the similar issue in our CI system. node
is not available in the $PATH
, any node
command is proxied via another executable, something like cmd node script.js
I am wondering if we could do something like
if [[ $* == *--dry-run* ]]; then
exit 1
else
if [[ -z "$BINARY" ]]; then
exit 1
fi
"$BINARY" "$("$BINARY" -e "console.log(require.resolve('pre-commit'))")"
fi
instead of
if [[ $* == *--dry-run* ]]; then
if [[ -z "$BINARY" ]]; then
exit 1
fi
else
"$BINARY" "$("$BINARY" -e "console.log(require.resolve('pre-commit'))")"
fi
at https://github.com/observing/pre-commit/blob/master/hook?
Please excuse my ignorance, if I am oversimplifying it.
Happy to raise a PR, if this is an accepted solution.
from pre-commit.
same error, ubuntu 18.04, vs code 1.28.2-1539735992, nvm 0.33.5, node v8.12.0, npm 6.4.1, git 2.19.1, pre-commit 1.2.2
from pre-commit.
I was having a similar issue trying to commit within VS Code in Ubuntu 18.04.
Just chiming in so that this helps someone else that end's up searching after having this issue
When using n for your Node Version Management, if you run into this issue, I was able to resolve it by adding PATH=$PATH:$HOME/n/bin
to the first line of my .git/hooks/pre-commit
file.
It now looks like this:
#!/bin/bash
PATH=$PATH:$HOME/n/bin
./node_modules/pre-commit/hook
RESULT=$?
[ $RESULT -ne 0 ] && exit 1
exit 0
from pre-commit.
The same problem.
from pre-commit.
Had this issue recently and it seemed to be related to using nvm-windows
Fixed this issue by making sure the following were included in the System Variables > Path (the definitions were already present in the User Variables Path):
%NVM_HOME%
%NVM_SYMLINK%
from pre-commit.
Related Issues (20)
- Add environment variable
- doesn't work with vue-cli v3.x HOT 1
- Document how to turn this off permanently HOT 3
- install.js doesn't work with link file of .git.
- Question: Prevent pre-commit hook to continue on committing? HOT 5
- Does not find correct root. HOT 1
- Doesn't find git root when inside a submodule
- Commit f25888f doesnt seem to have been pushed to npm
- How to make pre-commit works just with npm ci?
- can't find any error detail HOT 1
- How to run pre-commit hook in docker container?
- make it compatible with yarn pnp
- [Bug] pre-commit don't work HOT 1
- pre-commit
- chmod 777 breaks CIS 6.1.10 (ensure no world writable files)
- [BUG] Install with --force Flag Overwrites pre-commit.old
- Is there any relationship with pre-commit.com?
- Package maintainance HOT 4
- pre-commit hook not working on macos
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 pre-commit.