Git commit reported an error.

  git, question

Git commit project reported an error.

Hint:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ lint:eslint --ext .js src test
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAdministratorAppDataRoamingnpm-cache_logs2018-07-11T09_37_29_235Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ precommit:npm run lint
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ precommit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAdministratorAppDataRoamingnpm-cache_logs2018-07-11T09_37_29_296Z-debug.log

husky – pre-commit hook failed (add –no-verify to bypass)

What is the reason and how to solve it?
Dear old iron, please take a look, thank you ~ _ ~

Npm run lint tip:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ lint:eslint --ext .js src test
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAdministratorAppDataRoamingnpm-cache_logs2018-07-11T09_53_08_135Z-debug.log

package.json:

{
“private”: true,
“scripts”: {
“start”: “set PORT=7101 && roadhog server”,
“build”: “roadhog build”,
“lint”: “eslint –ext .js src test”,
“precommit”: “npm run lint”
},
“dependencies”: {

"antd": "^3.6.3",
 "antd-mobile": "^2.1.4",
 "classnames": "^2.2.5",
 "crypto-js": "^3.1.9-1",
 "dva": "^2.1.0",
 "moment": "^2.21.0",
 "prop-types": "^15.6.0",
 "qs": "^6.5.1",
 "rc-form": "^2.1.7",
 "rc-queue-anim": "^1.5.0",
 "react": "^16.2.0",
 "react-dom": "^16.2.0",
 "react-images": "^0.5.17",
 "react-sticky": "^6.0.1",
 "react-zmage": "^0.2.1",
 "web-storage-cache": "^1.0.3"},

“devDependencies”: {
“antd-mobile-demo-data”: “^0.2.0”,
“babel-plugin-dva-hmr”: “^0.4.1”,
“babel-plugin-import”: “^1.6.3”,
“babel-plugin-transform-decorators-legacy”: “^1.3.4”,
“css-loader”: “^0.28.9”,
“eslint”: “^4.14.0”,
“eslint-config-umi”: “^0.1.1”,
“eslint-plugin-flowtype”: “^2.34.1”,
“eslint-plugin-import”: “^2.6.0”,
“eslint-plugin-jsx-a11y”: “^5.1.1”,
“eslint-plugin-react”: “^7.1.0”,
“husky”: “^0.12.0”,
“less”: “^2.7.3”,
“less-loader”: “^4.0.5”,
“redbox-react”: “^1.4.3”,
“roadhog”: “^2.0.0”,
“style-loader”: “^0.19.1”
}
}

The reason for this is that the landlord used ithuskyAnd is configured with"precommit": "npm run lint"

Therefore, it will be executed when you git commit.npm run lintThat is,eslint --ext .js src test
If an error is reported, a non-zero is returned, thus organizing the code commit.

Therefore, there are two ways to solve this problem:

  1. Execute npm run lint, modify the error according to the prompt, and if it is someone else’s fault, ask for assistance (recommended)
  2. Git commit -m ” -n forced push