git找不到node?-灵析社区

LightSea

git commit 后提示 'node' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 husky - pre-commit hook exited with code 1 (error) ,有node而且在命令行正确出来node的,网上什么删除最近的提交等等方法都不行 最后就删除了git,重新创建版本库,就正常了 提交了几次后,又突然提示找不到node了 那就再次删除,后面又重演上面说的 然后重新克隆到新的文件夹也没有用,还是会提交了几次后,又突然提示找不到node了 删除了n多遍,也重新克隆了n多遍,不知道为啥这样 下面是项目中的配置 pre-commit : #!/bin/sh . "$(dirname "$0")/_/husky.sh" npx lint-staged commit-msg : #!/bin/sh . "$(dirname "$0")/_/husky.sh" npx --no-install commitlint --edit husky.sh: #!/usr/bin/env sh if [ -z "$husky_skip_init" ]; then debug () { if [ "$HUSKY_DEBUG" = "1" ]; then echo "husky (debug) - $1" fi } readonly hook_name="$(basename -- "$0")" debug "starting $hook_name..." if [ "$HUSKY" = "0" ]; then debug "HUSKY env variable is set to 0, skipping hook" exit 0 fi if [ -f ~/.huskyrc ]; then debug "sourcing ~/.huskyrc" . ~/.huskyrc fi readonly husky_skip_init=1 export husky_skip_init sh -e "$0" "$@" exitCode="$?" if [ $exitCode != 0 ]; then echo "husky - $hook_name hook exited with code $exitCode (error)" fi if [ $exitCode = 127 ]; then echo "husky - command not found in PATH=$PATH" fi exit $exitCode fi

阅读量:178

点赞量:0

问AI
不好判断问题在哪里,应该和你的配置的 git hook 有关系。 husky应该是和项目走的,可能是husky里面配置了hook命令有关系。因为里面配置的执行的脚本有问题,可能是环境变量配置问题,也可能是路径权限问题。 https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241008/8350c105fbcb667e3ef21b4e1da70bd0.png