npm run cmd fails while cmd on command line works

后端 未结 1 1237
忘了有多久
忘了有多久 2021-02-13 18:40

In my HTTP Status Check project:

If I run node_modules/.bin/jshint . I get:

$ node_modules/.bin/jshint .
test/inAdapters_fileAdapter.js: lin         


        
1条回答
  •  花落未央
    2021-02-13 19:29

    Don't exit with a non-zero error code unless you really mean it. Except for uninstall scripts, this will cause the npm action to fail, and potentially be rolled back. If the failure is minor or only will prevent some optional features, then it's better to just print a warning and exit successfully.

    From https://www.npmjs.org/doc/misc/npm-scripts.html

    Use:

    node_modules/.bin/jshint .; true
    

    Or write a wrapper that calls jshint and then ignores the exit code and exits successfully with a exit code of zero.

    0 讨论(0)
提交回复
热议问题