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

Remove extra = in sharedb-legacy devDependency #623

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

ericyhwang
Copy link
Contributor

@ericyhwang ericyhwang commented Sep 14, 2023

In the latest Node 18.17.1 with NPM 6, sharedb fails to install with an "Invalid URL" error.

I traced it back to an attempted parsing of "npm:sharedb@=1.1.0", which is the specifier for the sharedb-legacy devDependency.

According to node-semver:

A leading "=" or "v" character is stripped off and ignored.

It seems something in the combination of latest Node 18 with NPM 6 isn't stripping the =.

Node 18 by default comes with NPM 9, which is why sharedb's CI didn't break. However, NPM 6 is still supported since NPM 7 made some notable breaking changes, and the = somehow breaks things even when sharedb is installed as a dependency.

Since the = is meaningless in the specifier, removing it fixes the issue and shouldn't affect anything.

Click to see full NPM stack trace
5579 verbose stack TypeError [ERR_INVALID_URL]: Invalid URL
5579 verbose stack     at new NodeError (node:internal/errors:405:5)
5579 verbose stack     at Url.parse (node:url:445:17)
5579 verbose stack     at Object.urlParse [as parse] (node:url:167:13)
5579 verbose stack     at fixupUnqualifiedGist (/usr/local/lib/node_modules/npm/node_modules/hosted-git-info/index.js:99:20)
5579 verbose stack     at fromUrl (/usr/local/lib/node_modules/npm/node_modules/hosted-git-info/index.js:40:13)
5579 verbose stack     at module.exports.fromUrl (/usr/local/lib/node_modules/npm/node_modules/hosted-git-info/index.js:32:18)
5579 verbose stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js:150:36)
5579 verbose stack     at Array.forEach (<anonymous>)
5579 verbose stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js:144:31)
5579 verbose stack     at Array.forEach (<anonymous>)
5579 verbose stack     at Object.fixDependencies (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js:137:41)
5579 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:32:38
5579 verbose stack     at Array.forEach (<anonymous>)
5579 verbose stack     at normalize (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:31:15)
5579 verbose stack     at new Manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/finalize-manifest.js:116:3)
5579 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/pacote/lib/finalize-manifest.js:52:13

Fixes "Invalid URL" error in latest Node 18.17.1 with NPM 6
@coveralls
Copy link

Coverage Status

coverage: 97.512%. remained the same when pulling 6231ca6 on fix-sharedb-legacy-spec into a575e6a on master.

@ericyhwang ericyhwang merged commit fc300f5 into master Sep 14, 2023
4 checks passed
@ericyhwang ericyhwang deleted the fix-sharedb-legacy-spec branch September 14, 2023 23:31
@ericyhwang
Copy link
Contributor Author

In addition to publishing this onto the current v4, I've also cherry-picked this onto v2 and v3 and published them:

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

Successfully merging this pull request may close these issues.

4 participants