fix detecting node-addon packages (#908)

This commit is contained in:
Fangjun Kuang
2024-05-23 19:52:19 +08:00
committed by GitHub
parent 2db777587e
commit e7b7348102
4 changed files with 11 additions and 9 deletions

View File

@@ -27,9 +27,10 @@ for (const p of possible_paths) {
if (!found) {
let msg = `Could not find sherpa-onnx-node. Tried\n\n ${
possible_paths.join('\n ')}\n`
if (os.platform() == 'darwin' && process.env.DYLD_LIBRARY_PATH &&
!process.env.DYLD_LIBRARY_PATH.includes(
`node_modules/sherpa-onnx-${platform_arch}`)) {
if (os.platform() == 'darwin' &&
(!process.env.DYLD_LIBRARY_PATH ||
!process.env.DYLD_LIBRARY_PATH.includes(
`node_modules/sherpa-onnx-${platform_arch}`))) {
msg +=
'Please remeber to set the following environment variable and try again:\n';
@@ -39,9 +40,10 @@ if (!found) {
msg += ':$DYLD_LIBRARY_PATH\n';
}
if (os.platform() == 'linux' && process.env.LD_LIBRARY_PATH &&
!process.env.LD_LIBRARY_PATH.includes(
`node_modules/sherpa-onnx-${platform_arch}`)) {
if (os.platform() == 'linux' &&
(!process.env.LD_LIBRARY_PATH ||
!process.env.LD_LIBRARY_PATH.includes(
`node_modules/sherpa-onnx-${platform_arch}`))) {
msg +=
'Please remeber to set the following environment variable and try again:\n';