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

Bug: pnpm install fails ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND #56

Open
1 task
MikeMcC399 opened this issue Feb 19, 2025 · 10 comments
Open
1 task

Bug: pnpm install fails ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND #56

MikeMcC399 opened this issue Feb 19, 2025 · 10 comments
Labels
bug Something isn't working

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Feb 19, 2025

Environment

ESLint version: N/A
@eslint/css version: 0.4.0
Node version: v22.14.0 LTS
pnpm version: 10.4.1
Operating System: Ubuntu 24.04.2 LTS

This is a regression from @eslint/css version: 0.2.0
Also reproducible on @eslint/css version: 0.3.0
Also reproducible with pnpm@10.5.0

Installations using Yarn 1 Classic v1.22.22 are also failing.

Which language are you using?

N/A

What did you do?

corepack enable pnpm
cd $(mktemp -d)
corepack use pnpm@10.4.1
pnpm add @eslint/css@0.4.0

What did you expect to happen?

pnpm should install without error

What actually happened?

 ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND

$ corepack enable pnpm
cd $(mktemp -d)
corepack use pnpm@10.4.1
pnpm add @eslint/css@0.4.0
Installing pnpm@10.4.1 in the project...

Already up to date
Done in 956ms using pnpm v10.4.1
 ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND  Could not install from "/tmp/tmp.Y6rHpfEfdA/typings/css-tree" as it does not exist.

This error happened while installing the dependencies of @eslint/css@0.4.0
Progress: resolved 1, reused 0, downloaded 0, added 0

Link to Minimal Reproducible Example

See above for short repro steps ⬆

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@MikeMcC399 MikeMcC399 added the bug Something isn't working label Feb 19, 2025
@ntnyq
Copy link

ntnyq commented Feb 19, 2025

As I tested. pnpm and yarn@v1 would fail in installation.

npm and bun works fine.

@nzakas
Copy link
Member

nzakas commented Feb 19, 2025

Thanks for the report. pnpm and Yarn do strange things with dependencies to try to "optimize", which can cause problems. Please try the suggested settings in our README and let me know if that helps:
https://github.com/eslint/eslint?tab=readme-ov-file#pnpm-installation

@nzakas nzakas added this to Triage Feb 19, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Feb 19, 2025
@nzakas nzakas moved this from Needs Triage to Triaging in Triage Feb 19, 2025
@MikeMcC399
Copy link
Contributor Author

MikeMcC399 commented Feb 19, 2025

@nzakas

Thanks for the report. pnpm and Yarn do strange things with dependencies to try to "optimize", which can cause problems. Please try the suggested settings in our README and let me know if that helps: https://github.com/eslint/eslint?tab=readme-ov-file#pnpm-installation

Adding the suggestions for .npmrc did not change the outcome

pnpm repro

corepack enable pnpm
cd $(mktemp -d)
cat > .npmrc <<EOT
auto-install-peers=true
node-linker=hoisted
EOT
corepack use pnpm@10.4.1
pnpm add @eslint/css@0.4.0

@MikeMcC399
Copy link
Contributor Author

For comparison

Yarn Classic repro

fails:

corepack enable yarn
cd $(mktemp -d)
corepack use yarn@1
yarn add @eslint/css@0.4.0

Yarn (Modern) repro

no failure:

corepack enable yarn
cd $(mktemp -d)
corepack use yarn@4
yarn add @eslint/css@0.4.0

@CavaliereDavid
Copy link

I’m also encountering this issue when trying to install @eslint/css@0.4.0 using pnpm. Even after applying the recommended .npmrc settings:

auto-install-peers=true
node-linker=hoisted

the installation still fails with:

ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND  Could not install from ".../typings/css-tree" as it does not exist.

Environment:

OS: macOS
Node.js version: v22.12.0
pnpm version: 10.3.0

I also enabled fnm env --use-on-cd to allow auto-switching between Node.js versions, but the issue persists.

@MikeMcC399
Copy link
Contributor Author

@nzakas

As a feasibility exercise I forked the repo and added a workflow

https://github.com/MikeMcC399/css/blob/prime/.github/workflows/ci-build-all-pm.yml

which builds the package and then installs it on different package managers

https://github.com/MikeMcC399/css/actions/runs/13432882751 is an example run which shows where it fails:

Image

I don't know if this should be part of the regular CI. It would be unusual for npm packages to be tested like this. We should cover this in a separate issue if you want to follow up.

@nzakas
Copy link
Member

nzakas commented Feb 20, 2025

@MikeMcC399 thanks! I think that's something we can consider. I'd say go ahead and send a PR as I think that's helpful.

So looking at this a bit closer, it looks like pnpm interprets file: as meaning relative to the current working directory vs. relative to the package's installation directory. It seems like this may be a bug, so opened an issue here:
pnpm/pnpm#9141

It also seems like this was a bug in Yarn as the most recent version doesn't exhibit this behavior. Maybe we can just ask people to upgrade their Yarn if they run into this problem?

@MikeMcC399
Copy link
Contributor Author

MikeMcC399 commented Feb 21, 2025

@nzakas

I think that's something we can consider. I'd say go ahead and send a PR as I think that's helpful.

I will wait until there is some feedback from pnpm, as I don't want to submit a PR which will fail in CI.

So looking at this a bit closer, it looks like pnpm interprets file: as meaning relative to the current working directory vs. relative to the package's installation directory. It seems like this may be a bug, so opened an issue here: pnpm/pnpm#9141

I'll monitor this issue.

It also seems like this was a bug in Yarn as the most recent version doesn't exhibit this behavior. Maybe we can just ask people to upgrade their Yarn if they run into this problem?

@nzakas
Copy link
Member

nzakas commented Feb 21, 2025

Just as a heads-up: We're going to be creating our own fork of CSSTree that will bundle its own types, so we'll be able to move away from this file: approach shortly and that should fix everything on the various package managers.

@MikeMcC399
Copy link
Contributor Author

MikeMcC399 commented Feb 21, 2025

@nzakas

Just as a heads-up: We're going to be creating our own fork of CSSTree that will bundle its own types, so we'll be able to move away from this file: approach shortly and that should fix everything on the various package managers.

That sounds like a good decision! You can ignore my comment in the Yarn v1 issue in that case 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Evaluating
Development

No branches or pull requests

4 participants