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: Invalid Version: 723 #830

Closed
drmrbrewer opened this issue Feb 22, 2021 · 7 comments
Closed

TypeError: Invalid Version: 723 #830

drmrbrewer opened this issue Feb 22, 2021 · 7 comments
Labels

Comments

@drmrbrewer
Copy link

drmrbrewer commented Feb 22, 2021

I'm getting the above error, with the relevant info below:

# ncu -u
Upgrading /root/workspace/myapp/package.json
[====================] 28/28 100%
/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/lib/index.js:377
  throw err
  ^

TypeError: Invalid Version: 723
	at new SemVer (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/semver/classes/semver.js:38:13)
	at outside (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/semver/ranges/outside.js:12:13)
	at Object.ltr (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/semver/ranges/ltr.js:3:42)
	at isUpgradeable (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/lib/versionmanager.js:120:17)
	at /root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/lib/versionmanager.js:65:67
	at /root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:13616:16
	at basePickBy (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:3783:13)
	at Function.pickBy (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:13615:14)
	at /root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:4388:28
	at arrayReduce (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:683:21)
	
# ncu --version
11.1.4

Content of package.json:

"dependencies": {
	...
	"mylibrary": "git+https://myusername:jfF8aS2d9fkasdLASD09@bitbucket.org/myusername/mylibrary.git#v723",
	...
}

Whilst a version name of v723 is non-standard, it was explicitly allowed previously in ncu... see here.

EDIT it works in 11.1.3... only broke in 11.1.4.

@raineorshine
Copy link
Owner

raineorshine commented Feb 22, 2021

Thanks! I'll look into it. Interesting that the tests didn't catch this.

@raineorshine
Copy link
Owner

Could you run ncu --loglevel verbose please?

@drmrbrewer
Copy link
Author

# ncu --loglevel verbose
Initializing
Running in local mode
Finding package file data
Checking /root/workspace/myapp/package.json
Fetching latest versions

Options:
{
  args: [],
  bundle: true,
  cli: true,
  concurrency: 8,
  deep: false,
  dev: true,
  errorLevel: 1,
  format: [],
  json: false,
  loglevel: 'verbose',
  minimal: false,
  optional: true,
  packageManager: 'npm',
  peer: true,
  prefix: null,
  prod: true,
  target: 'latest',
  version: '11.1.4'
}
[====================] 28/28 100%
/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/lib/index.js:377
  throw err
  ^

TypeError: Invalid Version: 723
	at new SemVer (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/semver/classes/semver.js:38:13)
	at outside (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/semver/ranges/outside.js:12:13)
	at Object.ltr (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/semver/ranges/ltr.js:3:42)
	at isUpgradeable (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/lib/versionmanager.js:120:17)
	at /root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/lib/versionmanager.js:65:67
	at /root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:13658:16
	at basePickBy (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:3825:13)
	at Function.pickBy (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:13657:14)
	at /root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:4430:28
	at arrayReduce (/root/.nvm/versions/node/v14.15.5/lib/node_modules/npm-check-updates/node_modules/lodash/lodash.js:697:21)

@raineorshine
Copy link
Owner

raineorshine commented Feb 22, 2021

I created a private BitBucket repository to try to reproduce, but unfortunately I was getting auth errors for some reason.

npm-check-updates uses parse-github-url to parse all git urls (despite the name "github"). I wonder if it's not parsing your url properly.

Could you try running this in an empty directory and let me know what you get (blanking out credentials as needed)?

npm install --save parse-github-url
node -e "console.log(require('parse-github-url')('git+https://myusername:jfF8aS2d9fkasdLASD09@bitbucket.org/myusername/mylibrary.git#v723'))"

@drmrbrewer
Copy link
Author

Here you go (replacing credentials with the dummy ones used in the example):

# node -e "console.log(require('parse-github-url')('git+https://myusername:jfF8aS2d9fkasdLASD09@bitbucket.org/myusername/mylibrary.git#v723'))"
Url {
  protocol: 'git+https:',
  slashes: true,
  auth: 'myusername:jfF8aS2d9fkasdLASD09',
  host: 'bitbucket.org',
  port: null,
  hostname: 'bitbucket.org',
  hash: '#v723',
  search: null,
  query: null,
  pathname: 'myusername/mylibrary.git',
  path: 'myusername/mylibrary.git',
  href: 'git+https://myusername:jfF8aS2d9fkasdLASD09@bitbucket.org/myusername/mylibrary.git#v723',
  filepath: null,
  owner: 'myusername',
  name: 'common',
  repo: 'myusername/mylibrary',
  branch: 'v723',
  repository: 'myusername/mylibrary'
}

@raineorshine
Copy link
Owner

Could you try ncu v11.1.8? I manually tested version 723 and made sure that versionUtil.isSimple could handle it.

@drmrbrewer
Copy link
Author

Works! 🎉🎉

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

No branches or pull requests

2 participants