charlierudolph / dependency-lint

Lints NPM dependencies and devDependencies
MIT License
14 stars 5 forks source link

dependency-lint fails ONLY when run from npm run script #48

Closed mrichmond closed 7 years ago

mrichmond commented 7 years ago

I've encountered a problem. After installing dependency-lint into my project I can run it just fine from ./node_modules/.bin/dependency-lint ...but if I put it inside an npm script is will run but error out at the very end.

EXAMPLE package.json: { "name": "DLINT'", "description": "dependency-lint NOT WORKING from 'npm run dependency-lint", "scripts": { "dependency-lint": "dependency-lint" }, "dependencies": { "webpack": "^2.3.2" }, "devDependencies": { "dependency-lint": "^5.0.1" } }

NPM RUN SCRIPT: $ npm run dependency-lint

RESULTS IN OUTPUT (WITH ERROR): ` DLINT@0.1.0 pretest /Users/user/workspace/dlint dependency-lint

dependencies: ✖ webpack (unused)

✖ 1 error

npm ERR! Darwin 15.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test" npm ERR! node v7.8.0 npm ERR! npm v4.2.0 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! DLINT@0.1.0 pretest: dependency-lint npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the DLINT@0.1.0 pretest script 'dependency-lint'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the DLINT package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! dependency-lint npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs DLINT npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls DLINT npm ERR! There is likely additional logging output above. `

mrichmond commented 7 years ago

(EDIT)I spoke too soon... I downgraded to "dependency-lint": "^4.3.2" and same problem.

mrichmond commented 7 years ago

So it seems to work fine UNLESS it encounters an error. Still seems like odd behaviour to me.

charlierudolph commented 7 years ago

npm scripts by default output that error message if they exit with a non-zero status. dependency-lint exits with a non-zero status if there are any errors.

If you have an npm script that is simply "false", it will output that error message.