npm 构建ElectronJS项目,但Sharp节点未启动

lzfw57am  于 5个月前  发布在  Electron
关注(0)|答案(1)|浏览(87)

我用ElectronJS构建了一个桌面应用程序,使用Sharp节点进行一些图像处理。用npm start从终端运行项目可以正常工作,没有任何问题。当我用electron-packager为桌面用户构建项目时,无论我尝试在什么操作系统上启动它,我都会得到一个错误,说“安装“sharp”模块时出错”。下面是在MacOS上读取的完整错误:

Uncaught Exception:
Error: 
Something went wrong installing the "sharp" module

dlopen(/var/folders/m9/h3c8db8n5vg98dn_46_0tb1cj60dj1/T/.com.electron.prototype.ruROOB, 0x0001): Library not loaded: @rpath/libvips-cpp.42.dylib
Referenced from: <8E44C8DA-AB29-314C-9D4D-0E8353480586> /private/var/folders/m9/h3c8db8n5vg98dn_46_0tb1cj60dj1/T/.com.electron.prototype.ruROOB
Reason: tried: '/private/var/folders/m9/h3c8db8n5vg98dn_46_0tb1cj60dj1/T/../.././vendor/8.14.5/darwin-x64/lib/libvips-cpp.42.dylib' (no such file), '/private/var/folders/m9/h3c8db8n5vg98dn_46_0tb1cj60dj1/T/../.././vendor/8.14.5/darwin-x64/lib/libvips-cpp.42.dylib' (no such file), '/Users/cjmagri/Documents/ElectronJS/prototype/prototype-darwin-x64/prototype.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libvips-cpp.42.dylib' (no such file), '/Users/cjmagri/Documents/ElectronJS/prototype/prototype-darwin-x64/prototype.app/Contents/Frameworks/libvips-cpp.42.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libvips-cpp.42.dylib' (no such file), '/private/var/folders/m9/h3c8db8n5vg98dn_46_0tb1cj60dj1/T/../.././vendor/8.14.5/darwin-x64/lib/libvips-cpp.42.dylib' (no such file), '/private/var/folders/m9/h3c8db8n5vg98dn_46_0tb1cj60dj1/T/../.././vendor/8.14.5/darwin-x64/lib/libvips-cpp.42.dylib' (no such file), '/Users/cjmagri/Documents/ElectronJS/prototype/prototype-darwin-x64/prototype.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libvips-cpp.42.dylib' (no such file), '/Users/cjmagri/Documents/ElectronJS/prototype/prototype-darwin-x64/prototype.app/Contents/Frameworks/libvips-cpp.42.dylib' (no such file), '/usr/local/lib/libvips-cpp.42.dylib' (no such file), '/usr/lib/libvips-cpp.42.dylib' (no such file, not in dyld cache)

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current darwin-x64 runtime: "npm install --platform=darwin --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
at Object.<anonymous> (/Users/cjmagri/Documents/ElectronJS/prototype/prototype-darwin-x64/prototype.app/Contents/Resources/app.asar/node_modules/sharp/lib/sharp.js:37:9)
at Module._compile (node:internal/modules/cjs/loader:1269:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
at Module.load (node:internal/modules/cjs/loader:1124:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1148:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/cjmagri/Documents/ElectronJS/prototype/prototype-darwin-x64/prototype.app/Contents/Resources/app.asar/node_modules/sharp/lib/constructor.js:11:1)
at Module._compile (node:internal/modules/cjs/loader:1269:14)

字符串
我已经做了很多在线论坛的故障排除,但没有一个解决方案似乎工作。这包括重建节点与详细,卸载和重新安装,然后也卸载通过自制的vip.有什么建议吗?

u5i3ibmn

u5i3ibmn1#

我在Linux上使用electron-builder时也遇到过类似的错误

asarUnpack:
  - resources/**
  - node_modules/sharp/**

字符串

相关问题