(GitKraken) Pre-commit Failed Exit Code: 1

自古美人都是妖i 提交于 2019-12-13 05:38:42

问题


I'm using GitKraken (not sure if relevant) and as I'm trying to commit, I get this error message:

And as I press the button "View Hook Output" I get the following:

pre-commit

husky > npm run -s precommit (node v8.9.4)[?25l

npm > Running tasks for src/**/*.js

\ yarn format git add (...lots of these two rows...)
\ yarn format git add

"yarn format" found some errors. Please fix them and try committing again. yarn run v1.6.0 $ prettier-standard './src/**/*.js' C:\mypath\myfile.js info[Visit [0;1mhttps://yarnpkg.com/en/docs/cli/run for documentation about this comand.

prettier-eslint [ERROR] eslint fix failed due to an eslint error prettier-standard [ERROR] There was an error formatting "C:\mypath\messages.js": TypeError: Cannot read property 'range' of null

at SourceCode.getTokenBefore (c:\mypath\index.js:303:18)
at checkSpacingBefore (C:\mypath\template-curly-spacing.js:52:42)
at TemplateElement (C:\mypath\template-curly-spacing.js:117:17)
at listeners.(anonymous function).forEach.listener (C:\mypath\safe-emitter.js:47:58)
at Array.forEach (<anonymous>)
at Object.emit (C:\mypath\safe-emitter.js:47:38)
at NodeEventGenerator.applySelector (C:\mypath\node_modules\eslint\lib\utilode-event-generator.js:251:26)
at NodeEventGenerator.applySelectors (C:\mypath\node_modules\eslint\lib\util\node-event-generator.js:280:22)
at NodeEventGenerator.enterNode (C:\mypath\node-event-generator.js:294:14)
at CodePathAnalyzer.enterNode (C:\mypath\code-path-analyzer.js:608:23)
at Traverser.enter [as _enter] (C:\mypath\node_modules\eslint\lib\linter.js:865:28)
at Traverser._traverse (C:\mypath\traverser.js:132:14)
at Traverser._traverse (C:\mypath\node_modules\eslint\lib\util\traverser.js:144:34)
at Traverser._traverse (C:\mypath\node_modules\eslint\lib\util\traverser.js:147:30)
at Traverser._traverse (C:\mypath\traverser.js:144:34)
at Traverser._traverse (C:\mypath\traverser.js:147:30)

failure formatting 1 file with prettier-standard error Command failed with exit code 1.

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

What is causing this? No one can commit anything on GitKraken or Sourcetree. Only on command line. Very strange. What might be the cause and solution to this? I've heard some comments about npm versions used by husky or yarn.


回答1:


I was having the same issue but managed to temporarily fix it by removing the precommit npm module, be mind full this is not the ideal way as precommit runs the test scripts before the code is pushed to your repository.

use below command to remove recommit. npm remove precommit



来源:https://stackoverflow.com/questions/50332953/gitkraken-pre-commit-failed-exit-code-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!