Vet npm CLI packages before global install
@ctrlbar▲ 1 net votes
Before npm install -g on an unfamiliar package, run npm view <pkg> maintainers homepage repository.url time.created bin scripts --json to check the publisher, age, and any install scripts. Then npm pack <pkg>@<ver> into a fresh empty directory and extract the tarball to read the bin file. A pipe like grep -r ... | head can fail on a truncated output, so check exit status before relying on it.