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

Fix (or document changes in) "file:" protocol #8053

Closed
2 of 4 tasks
artemis-prime opened this issue May 4, 2024 · 5 comments
Closed
2 of 4 tasks

Fix (or document changes in) "file:" protocol #8053

artemis-prime opened this issue May 4, 2024 · 5 comments

Comments

@artemis-prime
Copy link

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

9

Which area(s) of pnpm are affected? (leave empty if unsure)

Dependencies resolver

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

try to use 'file:../../path/to/some/modude' which now fails.

Describe the Bug

// root package.json

"pnpm": {
    "overrides": {
        "@mydomain/moduleName": "file:../../myOtherDomain/otherModuleName"

    }
  }

In 8.x, this is the main way that I used to do local dev on local modules (not in the host monorepo)

in 9.x, this produces:

 ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND  Could not install from "/home//mydoamin/monorepo/otherdomain/othermodulename/" as it does not exist.

 (ie, it's not even concatenating the filenames correctly!)

 Also, any mention of the "file:" protocol seems to be gone from the docs

Expected Behavior

Should install and use the module as specified with "file:" above.

Which Node.js version are you using?

18

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Mint 20

@zkochan
Copy link
Member

zkochan commented May 5, 2024

@KSXGitHub could this be related to the fix you did?

@KSXGitHub
Copy link
Contributor

KSXGitHub commented May 5, 2024

@zkochan It's hard to say. I cannot reproduce the bug with pd.

Here's my package.json:

{
  "private": true,
  "dependencies": {
    "@pnpm/tabtab": "*"
  },
  "pnpm": {
    "overrides": {
      "@pnpm/tabtab": "file:../../programming/pnpm-tabtab"
    }
  }
}

@KSXGitHub
Copy link
Contributor

And I cannot reproduce the bug with the latest release of pnpm (v9.0.6) either

@cognvn
Copy link

cognvn commented May 6, 2024

I have same issue with monorepo + pnpm.overrides.
Here is the demo repo reproducing the bug: https://github.com/cognvn/demo-pmpm-issue
In this example, I use @pnpm/types in workspaces apps/web and packages/ui, then overrride "@pnpm/types": "file:./tarball/pnpm-types-10.0.0.tgz" in root workspace

This commit 04310be fix absolute path issue but lost relation to root workspace directory.
How about resolving it like link: protocol:

if (versionOverride.linkTarget && dir) {
deps[versionOverride.targetPkg.name] = `link:${normalizePath(
path.relative(dir, versionOverride.linkTarget)
)}`
continue
}
if (versionOverride.linkFileTarget) {
deps[
versionOverride.targetPkg.name
] = `file:${versionOverride.linkFileTarget}`
continue
}

@KSXGitHub
Copy link
Contributor

I have created #8055

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

No branches or pull requests

4 participants