nodegui: webpack and nodegui >= 0.45.0 fails to find qt for linux and mac

Describe the bug using the nodegui-starter repo and upgrading the nodegui version to anything greater than version 0.45.0 runs npm install without error but fails at npm start with the following error: macos:

node:internal/modules/cjs/loader:1154
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: dlopen(/Users/user/nodegui-starter/dist/nodegui_core-b4830b7771312645d920eca30febd09e.node, 1): Library not loaded: @rpath/QtSvg.framework/Versions/5/QtSvg
  Referenced from: /Users/user/nodegui-starter/dist/nodegui_core-b4830b7771312645d920eca30febd09e.node
  Reason: image not found
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1154:18)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at eval (webpack://nodegui-starter/./node_modules/@nodegui/nodegui/build/Release/nodegui_core.node?:1:18)
    at Object../node_modules/@nodegui/nodegui/build/Release/nodegui_core.node (/Users/user/nodegui-starter/dist/index.js:2728:1)
    at __webpack_require__ (/Users/user/nodegui-starter/dist/index.js:3225:42)
    at eval (webpack://nodegui-starter/./node_modules/@nodegui/nodegui/dist/lib/utils/addon.js?:3:15)
    at Object../node_modules/@nodegui/nodegui/dist/lib/utils/addon.js (/Users/user/nodegui-starter/dist/index.js:2538:1) {
  code: 'ERR_DLOPEN_FAILED'
}

same for ubuntu:

node:internal/modules/cjs/loader:1154
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: libQt5Svg.so.5: cannot open shared object file: No such file or directory
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1154:18)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at eval (webpack://nodegui-starter/./node_modules/@nodegui/nodegui/build/Release/nodegui_core.node?:1:18)
    at Object../node_modules/@nodegui/nodegui/build/Release/nodegui_core.node (/home/user/nodegui-starter/dist/index.js:2643:1)
    at __webpack_require__ (/home/user/nodegui-starter/dist/index.js:3225:42)
    at eval (webpack://nodegui-starter/./node_modules/@nodegui/nodegui/dist/lib/utils/addon.js?:3:15)
    at Object../node_modules/@nodegui/nodegui/dist/lib/utils/addon.js (/home/user/nodegui-starter/dist/index.js:2538:1) {
  code: 'ERR_DLOPEN_FAILED'
}

my main Debian installation is giving this error:

 /home/user/nodegui-starter/node_modules/@nodegui/qode/binaries/qode: symbol lookup error: /home/user/nodegui-starter/dist/nodegui_core-8196945af58ab1cdb04d9aef54819722.node: undefined symbol: _ZdlPvm, version Qt_5

because its using system wide qt ?

windows is working fine

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/nodegui/nodegui-starter
  2. edit nodegui version in package.json to something >= 0.45.0
  3. npm install
  4. npm start

Expected behavior the window of the example app shows up

Desktop:

  • OS: macOS 11.6.1 (VM), Ubuntu 20.04 (VM), Debian 11
  • NodeGUI version >= 0.45.0

maybe this is a webpack configuration problem but I was not able to solve it

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 5
  • Comments: 19

Most upvoted comments

Got it to work on my machine (MacOS Monterey 12.5). I checked the dependency’s build/Release directory and it seems like installing nodegui into a project doesn’t correctly rebuild the native artifacts in there.

So run this (starting from your project root):

pushd node_modules/@nodegui/nodegui
npm run build:addon
popd

Then run npm run start as before.

FYI, I’ve spent some time this week on a new starter project. The basics are in place and you can have a look at it here: https://github.com/sedwards2009/nodegui-simple-starter