-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] Unable to install/downgrade with tilde versioning #636
Comments
I’d expect the explicit prefix right be honored, but lacking that, you can |
This works, although on macOS and Linux, you have to do |
Ran into this problem today in Edit: Still a bug in |
I'm not too familiar with the architecture of npm, but I believe this bug would be for arborist. It uses npm-package-arg (npa) to parse package name and specifier, but npa is working as intended: const npa = require("npm-package-arg");
console.log(JSON.stringify(npa("typescript@~3.5.0"), undefined, 2));
// {
// "type": "range",
// "registry": true,
// "raw": "typescript@~3.5.0",
// "name": "typescript",
// "escapedName": "typescript",
// "rawSpec": "~3.5.0",
// "saveSpec": null,
// "fetchSpec": "~3.5.0"
// } The logic appears to be at These are my findings so far. |
Follow-up. It appears to be the const npa = require("npm-package-arg");
console.log(JSON.stringify(npa("~3.5.0"), undefined, 2));
// {
// "type": "tag",
// "registry": true,
// "raw": "~3.5.0",
// "name": "~3.5.0",
// "escapedName": "~3.5.0",
// "rawSpec": "",
// "saveSpec": null,
// "fetchSpec": "latest"
// } As you can see, the results are completely different. (1) It's not a if (this[_resolvedAdd]) {
const root = this.idealTree
const pkg = root.package
for (const { name } of this[_resolvedAdd]) {
- const req = npa(root.edgesOut.get(name).spec, root.realpath)
+ const req = npa.resolve(name, root.edgesOut.get(name).spec, root.realpath) I still think we should move this issue to arborist/npa for the issues respectively. @ux-engineer, I'll create the new tickets, referencing this ticket, and start working on a fix for both mentioned issues tomorrow |
Fixed in arborist some time ago. |
@isaacs i'm on npm 8.9.0 interestingly, if I do |
That’s expected since 0.28 isn’t in-range. |
What / Why
I have Typescript version ^3.7.4 installed as a devDependency in
package.json
:When
I want to downgrade Typescript locked to the minor version 3.5, but with the newest patch versions applied. So the correct SemVer version tag would be with the tilde character, so ~3.5.0 in this case.
Current Behavior
Using NPM version 6.9.0 and Node 12.5.0.
I have tried running
npm i -D typescript@~3.5.0
, however after the installationpackage.json
has"typescript": "^3.5.3"
.Adding flag
--save-exact
doesn't work either, that results in"typescript": "3.5.3"
.Expected Behavior
Package.json should have been updated with
"typescript": "~3.5.3"
.References
The text was updated successfully, but these errors were encountered: