Browse Source

Print helpful message when package.json not found

Fixes https://github.com/feross/thanks/issues/69
master
Feross Aboukhadijeh 7 years ago
parent
commit
9517e70be7
  1. 7
      src/cmd.js

7
src/cmd.js

@ -389,6 +389,13 @@ async function openDonateLinks (donateLinks) {
async function readDirectPkgNames () { async function readDirectPkgNames () {
const pkgPath = await pkgUp() const pkgPath = await pkgUp()
if (pkgPath == null) {
throw new Error(
'No package.json found. Run this in a Node.js project folder!'
)
}
const pkgStr = await readFileAsync(pkgPath, 'utf8') const pkgStr = await readFileAsync(pkgPath, 'utf8')
let pkg let pkg

Loading…
Cancel
Save