MacOS w/ node-canvas, Library not loaded: /usr/local/opt/pixman/lib/libpixman-1.0.dylib
See original GitHub issueelectron-builder v 22.3.2
Uses node-canvas. Building for Windows and Linux appears to work properly, however with MacOS I get the following error when I try to run it on a fresh machine. Installing brew and installing the cairo build dependencies on the fresh machine allowed it to run.
Error: dlopen(/var/folders/mq/cwx7xp9d7qx68l0647xwybym0000gn/T/.com.camhart.netcountable.desktop.RA3whH, 1): Library not loaded: /usr/local/opt/pixman/lib/libpixman-1.0.dylib
Referenced from: /var/folders/mq/cwx7xp9d7qx68l0647xwybym0000gn/T/.com.camhart.netcountable.desktop.RA3whH
Reason: image not found
at process.func (electron/js2c/asar.js:140:31)
at process.func [as dlopen] (electron/js2c/asar.js:140:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1016:18)
at Object.func (electron/js2c/asar.js:140:31)
at Object.func [as .node] (electron/js2c/asar.js:149:18)
at Module.load (internal/modules/cjs/loader.js:816:32)
at Module._load (internal/modules/cjs/loader.js:728:14)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
xcode14:Library not loaded: /usr/l… | Apple Developer Forums
I use xcode 14 and run to iphone 11.2 , and my app crashes when runs. The crash log is " dyld: Library...
Read more >macos - dyld: Library not loaded ... Reason: Image not found
I think the problem has something to do with the executable only looking in the directory it is in as when I paste...
Read more >How to Fix 'Dyld: Library not Loaded' Error on MacOS - Appuals
It is possible to counter the problem by creating a Symbolic Link in the directory where the computer is checking for the “.dylib”...
Read more >Library not loaded: @rpath/libfreeimage-3.17.0.dylib
In the long run I guess we need to pin freeimage and update every freeimage dependent package. Or find a solution for osx,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nullxx thank you so much for your solution! It did fix my build issues on Windows, but not on MacOS. The compiled
canvas.node
still seemed to reference.dylib
files in my/usr/
directory, and not the ones copied/packaged. (My debugging process involved a lot ofotool -L canvas.node
andinstall_name_tool -change
if anyone’s interested)My final approach:
/node_modules/canvas/lib/dylib
)node-gyp rebuild
insidenode_modules/canvas
(which callsnode-gyp configure
anyway)buildDependenciesFromSource
,nodeGypRebuild
,npmRebuild
all to**false**
, as they seem to rebuild the library unneccesarily, breaking the references againnpx electron-rebuild -f -w canvas
, which I later added to thepackage.json
build/Release/canvas.node
with macpack (possible alternative: macdylibbundler)electron-builder --mac
to get a .dmg that functions on a fresh machine without cairo, pango etc. installed.Thanks again for your solution, I probably wouldn’t have figured it out alone!
@aWalrus try this solution:
node_modules/canvas/binding.gyp
:node-gyp configure
inside node_modules/canvasnode-gyp rebuild
inside node_modules/canvaspackage.json