Npm / pnpm node modules permissions issue

i am getting a ton of console errors about pnpm and/or npm (i have tried both) not being able to find any of my node modules, or having permissions problems accessing them.

every time i try to run npm install (or pnpm install) i get hundreds of console warnings. the latest batch all look like

npm WARN checkPermissions Missing write access to /app/client/node_modules/abbrev

(one line for every file in node_modules)

then at the end of all the warnings:

npm ERR! path /app/client/node_modules/abbrev
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access '/app/client/node_modules/abbrev'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

earlier i was getting

 WARN  Cannot find file at /rbd/pnpm-volume/d3241ff9-75e2-48c7-b5af-9317e1be576b/client/node_modules/abbrev although it was listed by readdir

also repeated hundreds of times for all node_modules

i have tried running enable-npm since it seemed like an issue with pnpm, but now am getting the missing write access error.

answers to other questions in this forum have suggested

$ rm -rf node_modules/* node_modules/.*

but when i try that i get

rm: refusing to remove '.' or '..' directory: skipping 'node_modules/.'
rm: refusing to remove '.' or '..' directory: skipping 'node_modules/..'

any idea how to fix this?

Sorry for the issues. I’m assuming this is the same project as your other open thread? If so, I’ll take a look when you let me know the project name or provide a join link. You shouldn’t need to run install on modules, just adding them to your package.json file should do it.