Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: 'NSArray' may not respond to...' when working with electron. #403

Open
bennik88 opened this issue Jul 29, 2022 · 2 comments
Open

Comments

@bennik88
Copy link

I tried all possible things to make drivelist compatible with electron but I always end up with the same warning when trying to rebuild native Node.js modules with electron-rebuild.

  • drivelist version: 11.0.0
  • Node version: v16.13.0
  • OS: macOS Monterey 12.4
  • electron-react-boilerplate version: 4.6.0

Error:

⠹ Building module: drivelist, Completed: 0../src/darwin/REDiskList.m:29:13: warning: 'NSArray' may not respond to 'sortUsingSelector:'
    [_disks sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
     ~~~~~~ ^
1 warning generated.

Is there any fix I'm not seeing? I like working with drivelist and it would be great to use it.

@zwhitchcox
Copy link
Contributor

zwhitchcox commented Jul 29, 2022

@bennik88 Hi, can you try rolling back to 9.2.4 and seeing if you get the same error? If you still get the same error, it's just warning and is probably ok, as it's been used in production for several years.

@bennik88
Copy link
Author

bennik88 commented Jul 29, 2022

Hi @zwhitchcox thank you for your fast response.

I'm installing the package to /release/app $ npm install drivelist@9.2.4
After that I run $(npm bin)/electron-rebuild

But I get the same error when rebuilding

⠇ Building module: drivelist, Completed: 0../src/darwin/REDiskList.m:29:13: warning: 'NSArray' may not respond to 'sortUsingSelector:'
    [_disks sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
     ~~~~~~ ^
1 warning generated.

I can't even start the app with npm start after that because I get the following error message:

Electron encountered an error

Error: Module did not self-register: '/Users/benjamin/Desktop/electron-hard-drive-manager/release/app/node_modules/drivelist/build/Release/drivelist.node'.
at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1199:18)
at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1812)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:829:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Function.Module._load (/Users/benjamin/Desktop/electron-hard-drive-manager/node_modules/runtime-required/runtime-required.js:34:23)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at bindings (/Users/benjamin/Desktop/electron-hard-drive-manager/release/app/node_modules/bindings/bindings.js:112:48

Also is it possible to use import instead of require?

@jellyfish-bot jellyfish-bot changed the title warning: 'NSArray' may not respond to...' when working with electron. warning: 'NSArray' may not respond to...' when working with electron. Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants