git commit error /.bin/lint-staged: line 12: node: command not found

git bash or in tools such as Vscode, an error occurs when performing git commit

/node_modules/.bin/lint-staged: line 12: node: command not found
husky > pre-commit hook failed (add --no-verify to bypass)

I found the source code of lint-staged and took a look at it, and found that the error message was this sentence

  node  "$basedir/../lint-staged/bin/lint-staged" "$@"

Later, I found that when I reinstalled node, I did not add the environment variables again, which caused it to be unable to execute this sentence, so I just need to reinstall node and configure the environment variables.

You can refer to this configuration environment variable https://jingyan.baidu.com/article/64d05a021974acde54f73b70.html

Guess you like

Origin blog.csdn.net/m0_65035567/article/details/128303855