Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'includes' of undefined #72

Closed
adambro opened this issue Feb 18, 2018 · 1 comment
Closed

TypeError: Cannot read property 'includes' of undefined #72

adambro opened this issue Feb 18, 2018 · 1 comment

Comments

@adambro
Copy link

adambro commented Feb 18, 2018

It happens for thanks global install and npx thanks run:

TypeError: Cannot read property 'includes' of undefined
    at isScopedPkg (/home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:205:18)
    at /home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:227:21
    at Generator.next (<anonymous>)
    at step (/home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:2:221)
    at _next (/home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:2:409)
    at /home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:2:477
    at new Promise (<anonymous>)
    at /home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:2:97
    at _fetchPkg (/home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:243:24)
    at fetchPkg (/home/adam/.npm-global/lib/node_modules/thanks/dist/cmd.js:220:24)
@feross
Copy link
Owner

feross commented Feb 20, 2018

Figured out the cause of this. If you have a folder in node_modules/ that has no package.json, then read-package-tree returns an empty object instead of a package.json.

That means the name property will be undefined, which eventually crashes when isScopedPkg() is called.

I fixed it at the source: ac8c39f

Released as 1.5.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants