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

Cannot read property 'split' of undefined #38

Closed
Kikobeats opened this issue Feb 26, 2021 · 2 comments · Fixed by #39
Closed

Cannot read property 'split' of undefined #38

Kikobeats opened this issue Feb 26, 2021 · 2 comments · Fixed by #39
Labels

Comments

@Kikobeats
Copy link
Contributor

Kikobeats commented Feb 26, 2021

Error trace

TypeError: Cannot read property 'split' of undefined
    at Object.cmp [as default] (/usr/src/app/node_modules/semver-compare/index.js:5:16)
    at Object.exports.default (/usr/src/app/node_modules/roarr/dist/cjs/src/factories/createRoarrInitialGlobalState.js:15:80)
    at Object.<anonymous> (/usr/src/app/node_modules/roarr/dist/cjs/src/log.js:35:46)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at Module.Hook._require.Module.require (/home/blessuser/.npm/_npx/5f7878ce38f1eb13/node_modules/require-in-the-middle/index.js:80:39)
    at require (node:internal/modules/cjs/helpers:92:18)

It's happening at this code point

https://github.com/gajus/roarr/blob/master/src/factories/createRoarrInitialGlobalState.ts#L12

I debugged that on my side. The thing happening is versions is an array of 1 element:

const versions = (currentState.versions || []).concat();
// => versions is [ '2.15.4' ]

so the sort fn

versions.sort(cmp);

is receiving

{ a: undefined, b: '2.15.4' }

so the semver-compare receives something non expected (it expects an string):

https://github.com/substack/semver-compare/blob/master/index.js#L2

@gajus
Copy link
Owner

gajus commented Feb 27, 2021

🎉 This issue has been resolved in version 4.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus
Copy link
Owner

gajus commented Feb 27, 2021

🎉 This issue has been resolved in version 4.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants