npm中执行shell脚本提示: git commit -m "add " husky > npm run -s precommit (node v14.4.0) '.' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 husky > pre-commit hook failed (add --no-verify to bypass)
[备忘录]npm中执行shell脚本提示: git commit -m "add " husky > npm run -s precommit (node v14.4.0) '.' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 husky > pre-commit hook failed (add --no-verify to bypass)
win10运行前端项目可能遇到以下情况
PS ...> yarn precommit
yarn run v1.22.4
$ ./build/pre-commit-lint.sh
Done in 1.26s.
PS ...> git commit -m "add "
husky > npm run -s precommit (node v14.4.0)
'.' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
husky > pre-commit hook failed (add --no-verify to bypass)
解决办法
修改package.json
,在precommit加上 sh ./build...
原package.json
"build": "node build/build.js",
"build:staging": "cross-env NODE_ENV=staging node build/build.js",
"release": "bash build/release.sh",
"release:staging": "cross-env NODE_ENV=staging bash build/release.sh",
"precommit": "./build/pre-commit-lint.sh"
},
"dependencies": {
"axios": "^0.19.2",
"vue": "^2.5.16",
"vue-router": "^3.3.4
修改后package.json
"build": "node build/build.js",
"build:staging": "cross-env NODE_ENV=staging node build/build.js",
"release": "bash build/release.sh",
"release:staging": "cross-env NODE_ENV=staging bash build/release.sh",
"precommit": "sh ./build/pre-commit-lint.sh"
},
"dependencies": {
"axios": "^0.19.2",
"vue": "^2.5.16",
"vue-router": "^3.3.4