`bcrypt` fails on installation with `node_modules`

Installation with existing node_modules directory fails with Cannot find module '../lib/main' Hello šŸ™‚ I'm encountering an issue with the bcrypt package. I have a turborepo/monorepo with an api package and other apps. The package depends on bcrypt. Every time I want to add a new dependency to any app/package I have to remove the root node_modules folder and only then can I install it - reinstallation / adding a new package causes the error below:
> pnpm install <anything>

...

node_modules/bcrypt: Running install script, failed in 43ms
node_modules/bcrypt install$ node-pre-gyp install --fallback-to-build
ā”‚ node:internal/modules/cjs/loader:1078
ā”‚ throw err;
ā”‚ ^
ā”‚ Error: Cannot find module '../lib/main'
ā”‚ Require stack:
ā”‚ - /Users/peter/Developer/dinnery/node_modules/bcrypt/node_modules/.bin/node-pre-gyp
| ...
ā”‚ Node.js v18.16.0
ā””ā”€ Failed in 44ms at /Users/peter/Developer/dinnery/node_modules/bcrypt
> pnpm install <anything>

...

node_modules/bcrypt: Running install script, failed in 43ms
node_modules/bcrypt install$ node-pre-gyp install --fallback-to-build
ā”‚ node:internal/modules/cjs/loader:1078
ā”‚ throw err;
ā”‚ ^
ā”‚ Error: Cannot find module '../lib/main'
ā”‚ Require stack:
ā”‚ - /Users/peter/Developer/dinnery/node_modules/bcrypt/node_modules/.bin/node-pre-gyp
| ...
ā”‚ Node.js v18.16.0
ā””ā”€ Failed in 44ms at /Users/peter/Developer/dinnery/node_modules/bcrypt
Indeed, the lib/main file does not exist.
0 Replies
No replies yetBe the first to reply to this messageJoin