gpt4 book ai didi

javascript - Electron 无法在 OS X 上构建平台依赖项 fsevents 和/或 sqllite

转载 作者:行者123 更新时间:2023-11-30 19:41:20 25 4
gpt4 key购买 nike

我想使用 electron 将我的网络应用分发到 OS X。在改编期间,它使用了 sqlite3fsevents 的 Electron 额外依赖项。为了在本地成功运行该应用程序,我必须使用 ./node_modules/.bin/electron-rebuild -p -t "dev,prod,optional" 重建它们现在,当我运行 electron. 时,该应用程序就像一个魅力。但是当我尝试通过 electron-packer 打包它时。 它无法构建生产依赖项并且根本无法打包。

...
To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`
• writing effective config file=dist/builder-effective-config.yaml
• rebuilding native production dependencies platform=darwin arch=x64
Error: npm exited with code 1
Output:

> sqlite3@4.0.6 install /Users/home/Projects/app_desktop/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

Failed to execute '/usr/local/Cellar/node@8/8.15.1/bin/node /usr/local/Cellar/node@8/8.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)

Error output:
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.6/electron-v4.1-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.6 and electron@4.1.0 (electron-v4.1 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, unlink 'build/Makefile'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node@8/8.15.1/bin/node" "/usr/local/Cellar/node@8/8.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean"
gyp ERR! cwd /Users/home/Projects/app_desktop/node_modules/sqlite3
gyp ERR! node -v v8.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node@8/8.15.1/bin/node /usr/local/Cellar/node@8/8.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/home/Projects/app_desktop/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node@8/8.15.1/bin/node" "/Users/home/Projects/app_desktop/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/home/Projects/app_desktop/node_modules/sqlite3
node-pre-gyp ERR! node -v v8.15.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.6 install 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! /Users/home/.npm/_logs/2019-03-26T18_47_44_705Z-debug.log

at ChildProcess.childProcess.once.code (/usr/local/lib/node_modules/electron-builder/node_modules/builder-util/src/util.ts:244:14)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:915:16)
at Socket.stream.socket.on (internal/child_process.js:336:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:561:12)
From previous event:
at _rebuild (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/util/yarn.ts:179:5)
at rebuild (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/out/util/yarn.js:163:19)
at /usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/util/yarn.ts:20:11
at Generator.next (<anonymous>)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at _installOrRebuild (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/out/util/yarn.js:71:28)
at installOrRebuild (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/out/util/yarn.js:55:28)
at /usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:509:13
at Generator.next (<anonymous>)
From previous event:
at Packager.installAppDependencies (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:470:70)
at /usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:420:20
at Generator.next (<anonymous>)
From previous event:
at Packager.doBuild (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:396:24)
at /usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:366:57
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/electron-builder/node_modules/graceful-fs/graceful-fs.js:111:16
at /usr/local/lib/node_modules/electron-builder/node_modules/graceful-fs/graceful-fs.js:45:10
at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
at Packager._build (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:335:133)
at /usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:331:23
at Generator.next (<anonymous>)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at Packager.build (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:288:14)
at build (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/index.ts:59:28)
at build (/usr/local/lib/node_modules/electron-builder/src/builder.ts:228:10)
at then (/usr/local/lib/node_modules/electron-builder/src/cli/cli.ts:46:19)
at <anonymous>

我不知道从哪里开始解决这个问题。

最佳答案

在得到这个错误之前,第一次node-gyp失败时我没有阅读完整的错误信息,所以我只是运行sudo ...看看是否它被神奇地解决了,但之后出现了这个 EACCESS 错误。

后来我意识到我的 sudo 尝试搞砸了我的 node_modules 的权限,使用 -Rf 将其全部删除并重新安装。最初的 node-gyp 问题似乎与我的包的当前问题有关。

关于javascript - Electron 无法在 OS X 上构建平台依赖项 fsevents 和/或 sqllite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55364483/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com