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

Install error "TypeError: Cannot read property 'version' of null" #159

Closed
robbyrussell opened this issue Jan 2, 2020 · 4 comments · Fixed by #161
Closed

Install error "TypeError: Cannot read property 'version' of null" #159

robbyrussell opened this issue Jan 2, 2020 · 4 comments · Fixed by #161
Labels
bug Something isn't working enhancement New feature or request

Comments

@robbyrussell
Copy link

Thought I'd give this a whirl and hit a bug via npx version 6.4.1

$ npx gitmoji-changelog
▶  start     gitmoji-changelog v2.0.1
ℹ  info      init ./CHANGELOG.md
ℹ  info      use preset node
✖  error     TypeError: Cannot read property 'version' of null
    at getChangelog (/Users/robbyrussell/.npm/_npx/81174/lib/node_modules/gitmoji-changelog/src/cli.js:98:68)
    at <anonymous>

I was able to install via npm, though. Thought I might report this should it pop up for others.

@frinyvonnick
Copy link
Owner

frinyvonnick commented Jan 2, 2020

Thank you for reporting this issue @robbyrussell 🙏

This error is functionnal I need to improve error handling. The node preset returned null because it couldn't find a package.json file in your project folder or it is empty. Is it the case? If not did you use it on an open source project so I could reproduce the issue?

@robbyrussell
Copy link
Author

@frinyvonnick Oh, I was about to test it out on Oh My Zsh, which does not have a package.json.

https://github.com/ohmyzsh/ohmyzsh/

I suppose that's my bad for not understanding that it needed to be used on a Node-friendly project

@frinyvonnick
Copy link
Owner

Not at all, this information is missing from the usage section. That's a good catch. gitmoji-changelog has a preset system since 2.0.0 to enable supporting more projects that Node.js ones. Someone asked for a generic preset using a configuration file in issue #157. I will close the both issue as soon as the preset is made.

@frinyvonnick
Copy link
Owner

frinyvonnick commented Jan 5, 2020

@robbyrussell I fixed the error messages and created a generic preset. You can test it with the canary version.

Here is how to use the generic preset:

  1. Create a file .gitmoji-changelogrc at the project root with the following content
{
  "project": {
    "name": "ohmyzsh",
    "description": "A delightful community-driven (with nearly 1,500 contributors) framework for managing your zsh configuration",
    "version": "1.0.0"
  }
}
  1. Call gitmoji-changelog with the preset option set to generic
npx gitmoji-changelog@canary --preset generic

I tested it on ohmyzsh. It works 😄

I'll publish it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants