I couldn't build successfully in electron
qyn980427 opened this issue · 21 comments
Issue Summary
I have used sqlite3 in electron, which can be successfully dev, but the following error will be reported during build. I don't know how I should solve this problem, so I would like to ask if anyone can help me solve this problem.
The related dependency versions I use are as follows:
The sqlite3 version is 5.1.7,
The node-gyp version is 8.4.1.
The node version is 16.18.0.
The yarn version is 1.22.21
Relevant logs or output
yarn run v1.22.21
$ vue-tsc --noEmit && vite build && electron-builder
[unplugin-vue-components] component "Basic"(D:/work/xxx/xxx/src/components/SyncProgress/src/Basic.vue) has naming conflicts with other components, ignored.
vite v4.5.1 building for production...
node_modules/easemob-websdk/miniCore/miniCore.js (1:7237) Use of eval in "node_modules/easemob-websdk/miniCore/miniCore.js" is strongly discouraged as it poses security risks and may cause issues with minification.
node_modules/easemob-websdk/Easemob-chat.js (1:7237) Use of eval in "node_modules/easemob-websdk/Easemob-chat.js" is strongly discouraged as it poses security risks and may cause issues with minification.
✓ 1771 modules transformed.
dist/index.html 0.55 kB │ gzip: 0.40 kB
dist/assets/head2-58730d9e.jpg 4.94 kB
dist/assets/iconfont-f83ad384.ttf 5.21 kB
dist/assets/iconfont-43aa91a6.eot 5.38 kB
dist/assets/head3-8654d57e.jpg 8.01 kB
dist/assets/head1-44e62e25.jpg 8.23 kB
dist/assets/head-91484c92.jpg 9.90 kB
dist/assets/iconfont-0f08d651.svg 17.06 kB │ gzip: 6.11 kB
dist/assets/login-e2a4b4ad.png 247.52 kB
dist/assets/index-e066774d.css 0.15 kB │ gzip: 0.14 kB
dist/assets/PullPerson-1f2a124e.css 0.22 kB │ gzip: 0.14 kB
dist/assets/SingleChat-0bc457f9.css 0.30 kB │ gzip: 0.18 kB
dist/assets/SelfChatList-f581c094.css 0.52 kB │ gzip: 0.32 kB
dist/assets/index-9e7f23c0.css 0.82 kB │ gzip: 0.38 kB
dist/assets/BacklogList-a1abf7d2.css 1.49 kB │ gzip: 0.44 kB
dist/assets/el-radio-94b07b0d.css 4.39 kB │ gzip: 0.99 kB
dist/assets/GroupChat-1efd6e54.css 43.83 kB │ gzip: 5.22 kB
dist/assets/index-19300c20.css 379.31 kB │ gzip: 59.42 kB
dist/assets/index-72bdf85a.js 0.49 kB │ gzip: 0.35 kB
dist/assets/index-687f6d70.js 0.81 kB │ gzip: 0.56 kB
dist/assets/BacklogList-9596c239.js 1.65 kB │ gzip: 0.90 kB
dist/assets/PullPerson-d942f364.js 2.62 kB │ gzip: 1.35 kB
dist/assets/SelfChatList-07907cbf.js 3.26 kB │ gzip: 1.65 kB
dist/assets/SingleChat-05682c53.js 5.31 kB │ gzip: 2.49 kB
dist/assets/el-radio-52869d58.js 18.88 kB │ gzip: 7.49 kB
dist/assets/GroupChat-4045fd19.js 24.87 kB │ gzip: 7.58 kB
dist/assets/index-4b322429.js 2,015.87 kB │ gzip: 572.97 kB
(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 11.66s
vite v4.5.1 building for production...
✓ 21 modules transformed.
dist-electron/main/index.js 0.17 kB │ gzip: 0.11 kB
dist-electron/main/index-17415e26.js 1.27 kB │ gzip: 0.64 kB
dist-electron/main/index-17e8c2e0.js 2.52 kB │ gzip: 1.02 kB
dist-electron/main/index-1dff5a59.js 10.02 kB │ gzip: 4.11 kB
✓ built in 95ms
vite v4.5.1 building for production...
✓ 8 modules transformed.
dist-electron/preload/index.js 4.06 kB │ gzip: 1.59 kB
✓ built in 29ms
• electron-builder version=24.9.1 os=10.0.19044
• loaded configuration file=D:\work\xxx\electron-builder.json5
• @electron/rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies
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=release\1.0.0\builder-effective-config.yaml
• rebuilding native dependencies dependencies=sqlite3@5.1.7 platform=win32 arch=x64
• install prebuilt binary name=sqlite3 version=5.1.7 platform=win32 arch=x64 napi=
• build native dependency from sources name=sqlite3
version=5.1.7
platform=win32
arch=x64
napi=
reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
error=prebuild-install info begin Prebuild-install version 7.1.1
prebuild-install warn This package does not support N-API version 36
prebuild-install warn install prebuilt binaries enforced with --force!
prebuild-install warn install prebuilt binaries may be out of date!
prebuild-install info looking for local prebuild @ prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install info looking for cached prebuild @ C:\Users\user\AppData\Roaming\npm-cache_prebuilds\9aa761-sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install warn install connect ETIMEDOUT 20.205.243.166:443
• rebuilding native dependency name=sqlite3 version=5.1.7
⨯ cannot execute cause=exit status 1
$ prebuild-install -r napi || node-gyp rebuild
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
errorOut=prebuild-install warn This package does not support N-API version 27.2.1
prebuild-install warn install connect ETIMEDOUT 20.205.243.166:443
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@16.18.0 | win32 | x64
gyp info find Python using Python version 3.6.7 found at "C:\Users\user\AppData\Local\Programs\Python\Python36-32\python.exe"
gyp info find VS using VS2019 (16.11.34301.259) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\user\AppData\Local\Programs\Python\Python36-32\python.exe
gyp info spawn args [
gyp info spawn args 'D:\\work\\xxx\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'D:\\work\\xxx\\node_modules\\sqlite3\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'D:\\work\\xxx\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\user\\.electron-gyp\\27.2.1\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\user\\.electron-gyp\\27.2.1',
gyp info spawn args '-Dnode_gyp_dir=D:\\work\\xxx\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\user\\\\.electron-gyp\\\\27.2.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=D:\\work\\xxx\\node_modules\\sqlite3',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\\work\\xxx\\node_modules\\sqlite3\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
File "D:\work\xxx\node_modules\node-gyp\gyp\gyp_main.py", line 45, in <module>
sys.exit(gyp.script_main())
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 662, in script_main
return main(sys.argv[1:])
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 654, in main
return gyp_main(args)
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 639, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2140, in GenerateOutput
_GenerateProject(project, options, msvs_version, generator_flags, spec)
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1027, in _GenerateProject
return _GenerateMSBuildProject(project, options, version, generator_flags, spec)
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 3738, in _GenerateMSBuildProject
toolset,
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2219, in _GenerateMSBuildFiltersFile
easy_xml.WriteXmlIfChanged(content, filters_path, pretty=True, win32=True)
File "D:\work\xxx\node_modules\node-gyp\gyp\pylib\gyp\easy_xml.py", line 131, in WriteXmlIfChanged
existing = file.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xb7 in position 815: illegal multibyte sequence
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (D:\work\xxx\node_modules\node-gyp\lib\configure.js:259:16)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\work\\xxx\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\work\xxx\node_modules\sqlite3
gyp ERR! node -v v16.18.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
error Command failed with exit code 1.
command='C:\Program Files\nodejs\node.exe' 'C:\Users\user\AppData\Roaming\nvm\v16.18.0\node_modules\yarn\bin\yarn.js' run install
workingDir=D:\work\xxx\node_modules\sqlite3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Version
5.1.7
Node.js Version
16.18.0
How did you install the library?
yarn add sqlite3
The electron version is 27.1.0
Mee too. But the electron version is 9.3.3.
My electron app build also starts complaining.
Run prePackHook (_build-hooks/prePack.js)
• rebuilding native dependencies dependencies=sqlite3@5.1.7 platform=darwin arch=arm64
• install prebuilt binary name=sqlite3 version=5.1.7 platform=darwin arch=arm64 napi=
[[33m • build native dependency from sources name=sqlite3
version=5.1.7
platform=darwin
arch=arm64
napi=
[[33mreason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
error=prebuild-install info begin Prebuild-install version 7.1.1
prebuild-install warn This package does not support N-API version 36
prebuild-install warn install prebuilt binaries enforced with --force!
prebuild-install warn install prebuilt binaries may be out of date!
prebuild-install info looking for local prebuild @ prebuilds/sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz
prebuild-install info looking for cached prebuild @ /Users/bernhard/.npm/_prebuilds/c10e52-sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz
prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz
prebuild-install http 404 https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz
prebuild-install warn install No prebuilt binaries found (target=36 runtime=napi arch=arm64 libc= platform=darwin)
same here. I have temp workaround pnpm --prefix=node_modules/sqlite3 run rebuild
or also works for me
(cd $(dirname $(node -p 'require.resolve(
sqlite3/package.json)')) && pnpx prebuild-install -r napi --verbose)
or
(cd $(dirname $(node -p 'require.resolve(
sqlite3/package.json)')) && npx prebuild-install -r napi --verbose)
My electron app build also starts complaining.
Run prePackHook (_build-hooks/prePack.js) • rebuilding native dependencies dependencies=sqlite3@5.1.7 platform=darwin arch=arm64 • install prebuilt binary name=sqlite3 version=5.1.7 platform=darwin arch=arm64 napi= [[33m • build native dependency from sources name=sqlite3 version=5.1.7 platform=darwin arch=arm64 napi= [[33mreason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information) error=prebuild-install info begin Prebuild-install version 7.1.1 prebuild-install warn This package does not support N-API version 36 prebuild-install warn install prebuilt binaries enforced with --force! prebuild-install warn install prebuilt binaries may be out of date! prebuild-install info looking for local prebuild @ prebuilds/sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz prebuild-install info looking for cached prebuild @ /Users/bernhard/.npm/_prebuilds/c10e52-sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz prebuild-install http 404 https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz prebuild-install warn install No prebuilt binaries found (target=36 runtime=napi arch=arm64 libc= platform=darwin)
however that sounds like thing related to cache. When removed the cache it has been rebuild and more ore less started working (can't check with @electron/rebuild now but i guess it may work now)
https://github.com/prebuild/prebuild-install/blob/master/README.md#cache
I also noticed that node 18 has napi 9 so the requested target v36 might be a clue of the issue
ELECTRON_RUN_AS_NODE=1 electron -p process.versions.napi
> 9
the issue seems to be with one of legacy dependencies of electron-builder. I reported a bug there
me too!How did you solve it
@liyang9331
Workaround: use 5.1.6 instead of 5.1.7
#1748 (comment)
prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz
prebuild-install warn install Request timed out
why it is sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz, it is 404, why do it down sqlite3-v5.1.7-napi-v36-darwin-arm64.tar.gz?
I ran into the same issue trying to install 5.1.7. Installing 5.1.6 instead works builds with no issue.
npm install -E sqlite3@5.1.6
Running node v20.9.0 on my win 10 system, building with electron v28.1.4 and electron-builder v24.9.1
section of the output with env var "DEBUG=electron-builder"
• install prebuilt binary name=sqlite3 version=5.1.7 platform=win32 arch=x64 napi=
• execute command command='C:\Program Files\nodejs\node.exe' 'C:\Data\ZENDev\multisigappV1\node_modules\prebuild-install\bin.js' --platform=win32 --arch=x64 --target=36 --runtime=napi --verbose --force
workingDirectory=C:\Data\ZENDev\multisigappV1\node_modules\sqlite3
• build native dependency from sources name=sqlite3
version=5.1.7
platform=win32
arch=x64
napi=
reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
error=prebuild-install info begin Prebuild-install version 7.1.1
prebuild-install warn This package does not support N-API version 36
prebuild-install warn install prebuilt binaries enforced with --force!
prebuild-install warn install prebuilt binaries may be out of date!
prebuild-install info looking for local prebuild @ prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install http 404 https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install warn install No prebuilt binaries found (target=36 runtime=napi arch=x64 libc= platform=win32)
I ran into the same issue trying to install 5.1.7. Installing 5.1.6 instead works builds with no issue.
npm install -E sqlite3@5.1.6
Running node v20.9.0 on my win 10 system, building with electron v28.1.4 and electron-builder v24.9.1
section of the output with env var "DEBUG=electron-builder"
• install prebuilt binary name=sqlite3 version=5.1.7 platform=win32 arch=x64 napi= • execute command command='C:\Program Files\nodejs\node.exe' 'C:\Data\ZENDev\multisigappV1\node_modules\prebuild-install\bin.js' --platform=win32 --arch=x64 --target=36 --runtime=napi --verbose --force workingDirectory=C:\Data\ZENDev\multisigappV1\node_modules\sqlite3 • build native dependency from sources name=sqlite3 version=5.1.7 platform=win32 arch=x64 napi= reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information) error=prebuild-install info begin Prebuild-install version 7.1.1 prebuild-install warn This package does not support N-API version 36 prebuild-install warn install prebuilt binaries enforced with --force! prebuild-install warn install prebuilt binaries may be out of date! prebuild-install info looking for local prebuild @ prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz prebuild-install http 404 https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz prebuild-install warn install No prebuilt binaries found (target=36 runtime=napi arch=x64 libc= platform=win32)
Same here, this worked for me
I also encountered the same problem, why is the N-API version 36 instead of the specific version?
prebuild-install warn This package does not support N-API version 36
prebuild-install warn install prebuilt binaries enforced with --force!
prebuild-install warn install prebuilt binaries may be out of date!
prebuild-install info looking for local prebuild @ prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install info looking for cached prebuild @ E:\other\nodejs\node_cache\_prebuilds\6626a9-sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install http request GET https://npmmirror.com/mirrors/sqlite3//v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install http 404 https://npmmirror.com/mirrors/sqlite3//v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
prebuild-install warn install No prebuilt binaries found (target=36 runtime=napi arch=x64 libc= platform=win32)
@draungminoo Thank you so much
@draungminoo Thank you~!
me too.revert to 5.1.6 is ok.
我有一个不降低版本的做法:
- 在这里下载版本https://github.com/TryGhost/node-sqlite3/releases(我这里我下载的是sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz)。
- 修改文件名称:
sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz
改为sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
。
注意:我的系统是
Windows x64
,我下载也是对应版本。
- 在你的项目里创建
prebuilds
目录(当然也可以是其他任何地方)。 - 在你的项目里创建
.npmrc
文件,文件内容如下:
# Set Prebuilds Path
sqlite3_local_prebuilds=E:/electron-vite-vue/prebuilds
- 最后一步,将刚才下载的文件移动至
prebuilds
目录下, 文件目录结构如下
E:\electron-vite-vue\prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
- 开始构建项目吧!
pnpm build
same here. I guess something is wrong with version detecting logic, it is supposed to return 3 or 6, not 36
I revert to 5.1.6 got below error, anyone with me?
Uncaught Exception:
Error: Cannot find module 'mock-aws-s3'
Require stack:
- /Users/wenjoy/workspace/studio/order-system/out/order-system-darwin-arm64/order-system.app/Contents/Resources/app.asar/.vite/build/main.js
-
at Module._resolveFilename (node:internal/modules/cjs/loader:1055:15)
at s._resolveFilename (node:electron/js2c/browser_init:2:115476)
at Module._load (node:internal/modules/cjs/loader:908:27)
at c._load (node:electron/js2c/node_init:2:13672)
at Module.require (node:internal/modules/cjs/loader:1122:19)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (/Users/wenjoy/workspace/studio/order-system/out/order-system-darwin-arm64/order-system.app/Contents/Resources/app.asar/.vite/build/main.js:1:658)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1311:10)
at Module.load (node:internal/modules/cjs/loader:1098:32)
I revert to 5.1.6 got below error, anyone with me?
Uncaught Exception: Error: Cannot find module 'mock-aws-s3' Require stack: - /Users/wenjoy/workspace/studio/order-system/out/order-system-darwin-arm64/order-system.app/Contents/Resources/app.asar/.vite/build/main.js - at Module._resolveFilename (node:internal/modules/cjs/loader:1055:15) at s._resolveFilename (node:electron/js2c/browser_init:2:115476) at Module._load (node:internal/modules/cjs/loader:908:27) at c._load (node:electron/js2c/node_init:2:13672) at Module.require (node:internal/modules/cjs/loader:1122:19) at require (node:internal/modules/helpers:130:18) at Object.<anonymous> (/Users/wenjoy/workspace/studio/order-system/out/order-system-darwin-arm64/order-system.app/Contents/Resources/app.asar/.vite/build/main.js:1:658) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1311:10) at Module.load (node:internal/modules/cjs/loader:1098:32)
This one works:
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include/sqlcipher"
npm install sqlite3@5.1.6 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=27.3.9 --dist-url=https://electronjs.org/headers
node -e 'require("sqlite3")'
Jump in this issue today, my fix are:
- Remove module "prebuild" in dependency list (package.json) to allow electron builder rebuild using its header and ABI version.
- Update node-gyp to v10 to support new electron header (16+)
I have the same error even with 5.1.6 version :(
我有一个不降低版本的做法:
- 在这里下载版本https://github.com/TryGhost/node-sqlite3/releases(我这里我下载的是[sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz](https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz))。
- 修改文件名称:
sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz
改为sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
。注意:我的系统是
Windows x64
,我下载也是对应版本。
- 在你的项目里创建
prebuilds
目录(当然也可以是其他任何地方)。- 在你的项目里创建
.npmrc
文件,文件内容如下:# Set Prebuilds Path sqlite3_local_prebuilds=E:/electron-vite-vue/prebuilds
- 最后一步,将刚才下载的文件移动至
prebuilds
目录下, 文件目录结构如下E:\electron-vite-vue\prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz
- 开始构建项目吧!
pnpm build
在windows中 为什么我指定了路径 无效