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

No matter what I do, pnpm complains about the same missing file #7796

Open
2 of 4 tasks
CaptainN opened this issue Mar 14, 2024 · 6 comments
Open
2 of 4 tasks

No matter what I do, pnpm complains about the same missing file #7796

CaptainN opened this issue Mar 14, 2024 · 6 comments

Comments

@CaptainN
Copy link

CaptainN commented Mar 14, 2024

Verify latest release

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

pnpm version

8.15.4

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

CLI

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

No response

Reproduction steps

I have no idea how to reproduce it, but I tried dozens of ways to re-install this,a nd there just doesn't seem to be a simple way to say "don't use that directory" - or "reset all the settings to default/empty"

  • Uninstalled with npm (I have to install globally EVERY TIME I change the node version, for some reason)
  • Deleted all the files/directories using the instructions in the uninstall docs - most of which don't work (or don't work in the order they are in)
  • I generally use the "posix" install method, and use pnpm for switching versions, but I unstalled/deleted all that as best I could
  • I re-installed with corepack - that was a disaster, don't recommend that
  • I then just tried using npm i -g pnpm - resulted int he same error - always the same error
  • I then tried to literally delete everything, then re-installed using posix method, and still the same error

The error (VERY opaque):

❯ pnpm i
Scope: all 3 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
/Users/kevin.newman/repos/OHI/storybook:
 ENOENT  ENOENT: no such file or directory, open '/Users/kevin.newman/Library/pnpm/store/v3/files/14/98584680da89ab5f12450af072a589c9aeff7486143e75ab78ad2831a8493cac4090677ce7315391b19e113513ab2807be8c6d3d0c06d9ca26e5f2031fbde9-index.json'

I'm at a loss as to what to do here. This is not the first time I've had this error. Usually just re-installing pnpm (which I have to do frequently) solves this, but it's not working this time.

Describe the Bug

above

Expected Behavior

It should just work, without having to jump through hoops

Which Node.js version are you using?

20

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)

No response

@CaptainN
Copy link
Author

CaptainN commented Mar 14, 2024

yeah, uninstall, reinstall, and now I get this:

❯ node -v
v20.11.1
❯ pnpm i
Scope: all 3 workspace projects
Already up to date
/Users/kevin.newman/repos/OHI/storybook:
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your Node version is incompatible with "/next/14.0.0(@babel/core@7.23.2)(react-dom@18.2.0)(react@18.2.0)(sass@1.69.5)".

Expected version: >=18.17.0
Got: v18.5.0

This is happening because the package's manifest has an engines.node field specified.
To fix this issue, install the required Node version.
❯ pnpm node -v
v20.11.1

I haven't changed the node version at all. Does pnpm just not work with nvm? Maybe that should be noted somewhere.

@CaptainN
Copy link
Author

CaptainN commented Mar 14, 2024

I was able to resolve the initial error by just forcing pnpm to use a different directory (pnpm config set store-dir /path/to/.pnpm-store) - but there are issues here:

  • Uninstalling following the instructions seems to not actually reset enough to scratch to let this work out of the box
  • Out of the box, I was still getting that baffling error
  • Why can't pnpm keep track of the active node version? (this is an issue even when using pnpm to manage node versions, which is what I usually do)

@shalldie
Copy link

shalldie commented Mar 15, 2024

I met the same case

ENOENT: no such file or directory, open '.........-index.json'

macOS: 14.4 (23E214)
node: v20.11.1
pnpm: 8.15.4

I tried npm install pnpm -g and brew install pnpm, change the store-dir, the error is still there.
I use fnm to manage node.

@zkochan
Copy link
Member

zkochan commented Mar 17, 2024

The Node version issue was probably fixed by #7801

For the other issue with ENOENT: no such file or directory, open it would help to have some steps to reproduce. It is a serious issue if it happens but I assume it is hard to reproduce as I don't remember getting it.

@shalldie
Copy link

My ultimate solution is this:


Remove all node_modules in this monorepo project.
Not use glob such as rm -rf **/*/node_modules !!
Find every directory , and rm -rf ./node_modules one by one.


I don't know why, when after glob remove, I've checked every directory, I can make sure there's no node_modules, but it's broken.
When rm -rf ./node_modules one by one, it works 😂😂

I think it's caused by caching, when after pnpm store prune or change the store-dir.

@CaptainN
Copy link
Author

It's challenging to create a reproduction for this, since I'm not entirely sure what causes it. I just know that when it gets in to that state, the move is to either uninstall and reinstall pnpm, or to create a new store somewhere new.

I do recall I never had this trouble before trying to use nvm (I generally use pnpm for version switching, because it's about a billion times faster than nvm), which I only needed for very very old version of node (12/14), on rare occasion. Removing nvm doesn't resolve it. Whatever nvm does, it messes things up for good. I don't say this with any confidence.

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

3 participants