Error: Module did not self-register

I'm getting this error when I run my tests for some reason, how can I solve this?
Error when loading '/path/to/project/dist/commands/developer/eval.js': Error: Module did not self-register: '/path/to/project/node_modules/.pnpm/@[email protected]/node_modules/@sapphire/type/prebuild/type-node-v108-darwin-arm64-unknown-unknown/type.node'.
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/path/to/project/node_modules/.pnpm/@[email protected]/node_modules/@sapphire/type/src/index.ts:12:55)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12) {
code: 'ERR_DLOPEN_FAILED'
}
Error when loading '/path/to/project/dist/commands/developer/eval.js': Error: Module did not self-register: '/path/to/project/node_modules/.pnpm/@[email protected]/node_modules/@sapphire/type/prebuild/type-node-v108-darwin-arm64-unknown-unknown/type.node'.
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/path/to/project/node_modules/.pnpm/@[email protected]/node_modules/@sapphire/type/src/index.ts:12:55)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12) {
code: 'ERR_DLOPEN_FAILED'
}
5 Replies
TheRealJohan™
TheRealJohan™15mo ago
not sure if it's relevant but I'm using vitest and I'm on macOS (apple silicon) I already tried reinstalling node_modules, still the same error
Favna
Favna15mo ago
1. Did you install xcode command line tools? https://www.freecodecamp.org/news/install-xcode-command-line-tools/ 2. NodeJS version?
TheRealJohan™
TheRealJohan™15mo ago
yep, it's a strange issue, it works just fine if I delete the dist directory (currently using this as workaround) and I'm on LTS v18.17.1
Favna
Favna15mo ago
I think I've seen the error before but I really don't remember what it was FWIW I have a MacBook with an M1 chip and bots work just fine there
TheRealJohan™
TheRealJohan™15mo ago
yeah, it's just when I have the source code compiled + run tests with vitest that it gives me that error 🤔 running with node works perfectly fine, thanks anyway tho
Want results from more Discord servers?
Add your server