Skip to content

Commit 87f6994

Browse files
committed
fix: fix resolve loading issue on windows
1 parent 910a82d commit 87f6994

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

lib/load-addon.js

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/load-addon.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/load-addon.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import fs from "fs"
33

44
function findAddon(): any | undefined {
55
try {
6-
const addonParentDir = path.join(
6+
const addonParentDir = path.resolve(path.join(
77
__dirname,
88
"..",
99
"build",
1010
process.platform,
1111
process.arch,
1212
"node",
13-
)
13+
))
1414
const addOnAbiDirs = fs.readdirSync(addonParentDir).sort((a, b) => {
1515
return Number.parseInt(b, 10) - Number.parseInt(a, 10)
1616
})
@@ -23,9 +23,13 @@ function findAddon(): any | undefined {
2323
addon = require(addonPath)
2424
break
2525
} catch (err) {
26-
console.error(
27-
`Failed to load addon at ${addonPath}: ${err}\nTrying others...`,
28-
)
26+
if (fs.existsSync(addonPath)) {
27+
console.error(
28+
`Failed to load addon at ${addonPath}: ${err}\nTrying others...`,
29+
)
30+
} else {
31+
console.error(`No addon.node found in ${addonPath}\nTrying others...`)
32+
}
2933
}
3034
}
3135

0 commit comments

Comments
 (0)