'Why am I getting this error in husky (in react)?
I'm not good at English. I beg your pardon.
I wanted to apply 'prettier' before commit using husky & lint-staged.
So I installed 'husky@4', 'lint-staged', 'prettier'.
and my package.json is
{
"name": "42bob",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"node-sass": "^5.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"husky": "^4.3.8",
"lint-staged": "^11.1.2",
"prettier": "^2.3.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,jsx,json,tsx}": [
"prettier --write",
"git add"
]
}
}
However, when I commit, I get the following error:
'node' is not recognized as an internal or external command operable program or batch file
I already set environment variables and rebooted.
If I type 'node' in the cmd, node is running fine.
but why is that error popping up?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|