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

Build fails on Windows with Electron 11: 'napi_is_detached_arraybuffer': identifier not found #63

Closed
Christilut opened this issue Jan 11, 2021 · 7 comments

Comments

@Christilut
Copy link

√ Checking your system
√ Locating Application
/ Preparing native dependencies: 0 / 1←[2K←[1G←[36m-←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m\←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m|←[39m Preparing native dependencies: 0 / 1Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
←[2K←[1G←[36m/←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m-←[39m Preparing native dependencies: 0 / 1  nothing.c
←[2K←[1G←[36m\←[39m Preparing native dependencies: 0 / 1  win_delay_load_hook.cc
←[2K←[1G←[36m|←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m/←[39m Preparing native dependencies: 0 / 1  nothing.vcxproj -> C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\Release\\nothing.lib
←[2K←[1G←[36m-←[39m Preparing native dependencies: 0 / 1  unpack_sqlite_dep
←[2K←[1G←[36m\←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m|←[39m Preparing native dependencies: 0 / 1  Copying C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\Release\/obj/global_intermediate/sqlcipher-amalgamation-3031000/OpenSSL-Win64/msvcr12
  0.dll to C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\Release\
          1 file(s) copied.
  Copying C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\Release\/obj/global_intermediate/sqlcipher-amalgamation-3031000/OpenSSL-Win64/libeay3
  2.dll to C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\Release\
          1 file(s) copied.
←[2K←[1G←[36m/←[39m Preparing native dependencies: 0 / 1  sqlite3.c
←[2K←[1G←[36m-←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m\←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m|←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m/←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m-←[39m Preparing native dependencies: 0 / 1  win_delay_load_hook.cc
←[2K←[1G←[36m\←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m|←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m/←[39m Preparing native dependencies: 0 / 1  sqlite3.vcxproj -> C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\Release\\sqlite3.lib
←[2K←[1G←[36m-←[39m Preparing native dependencies: 0 / 1  backup.cc
←[2K←[1G←[36m\←[39m Preparing native dependencies: 0 / 1c:\users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\node_modules\node-addon-api\napi-inl.h(1575): error C3861: 'napi_is_detached_arraybuffer': identifier
 not found [C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\node_sqlite3.vcxproj]
c:\users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\node_modules\node-addon-api\napi-inl.h(1581): error C3861: 'napi_detach_arraybuffer': identifier not
found [C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher\build\node_sqlite3.vcxproj]
←[2K←[1G←[36m|←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m/←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[36m-←[39m Preparing native dependencies: 0 / 1←[2K←[1G←[?25h←[31m×←[39m Preparing native dependencies: 0 / 1
←[31m
An unhandled error has occurred inside Forge:←[39m
←[31mnode-gyp failed to rebuild 'C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher'.←[39m
←[31mError: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1←[39m

←[31m←[39m
←[31mError: node-gyp failed to rebuild 'C:\Users\user\workspace\my-app\node_modules\@journeyapps\sqlcipher'.←[39m
←[31mError: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1←[39m


←[31m    at ModuleRebuilder.rebuildNodeGypModule (C:\Users\user\workspace\my-app\node_modules\electron-rebuild\src\module-rebuilder.ts:231:13)←[39m
←[31m    at processTicksAndRejections (internal/process/task_queues.js:97:5)←[39m
←[?25h←[?25hnpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `npm run build && electron-forge start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2021-01-11T10_52_39_185Z-debug.log

Using version 5.0.0 with Electron 11.0.3 and Node 12.20.1 on Windows 10

I'm building it with electron-forge.

Anything I can try?

@rkistner
Copy link
Member

Thanks for the details, will investigate.

@rkistner
Copy link
Member

This compile error is caused by a weird build environment / incompatibility of electron-rebuild. I haven't located the exact issue, but building from source should not be required at all.

I've added new instructions on workarounds here: https://github.com/journeyapps/node-sqlcipher/blob/3870217c1245dd4253e2bac2ea8d1d12a8c4a2b6/README.md#usage-with-electron-forge--electron-rebuild

@Christilut
Copy link
Author

This results in the following error for me:

14:49:03.383 > Error: ERR_CONNECTION_REFUSED (-102) loading 'http://localhost:3000/main_window'
    at rejectAndCleanup (electron/js2c/browser_init.js:205:1493)
    at Object.failListener (electron/js2c/browser_init.js:205:1706)
    at Object.emit (events.js:315:20)
    at Object.EventEmitter.emit (domain.js:483:12)

I think it's because of onlyModules but I'm not sure what I'm supposed to put in there. Leaving it empty makes electron-rebuild skip module building on everything.

@rkistner
Copy link
Member

Yes, unfortunately electron-rebuild doesn't have an option to only exclude certain modules. You'll have to include all modules that do need to be rebuilt on the onlyModules array.

@Christilut
Copy link
Author

Any idea how I can tell what modules those are? I don't see any way in electron-rebuild to list them.

@rkistner
Copy link
Member

I don't know of an accurate way, but you can search for package.json files that contain a reference to node-gyp, node-pre-gyp or nan.

You should also check if you have other logs indicating why you don't have a server running on http://localhost:3000.

@Christilut
Copy link
Author

I tried adding everything that references node-gyp to onlyModules (except node-sqlcipher) but I get the same error.

I would also except there to be more logs why the localhost server isn't running, but I can't find a way to show more. It just seems to fail silently. I guess this is more of a electron-rebuild problem.

I'll wait for compatibility with electron-rebuild, not sure I can fix this on my end.

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