无法安装 better-sqlite3 discord.js
Posted
技术标签:
【中文标题】无法安装 better-sqlite3 discord.js【英文标题】:Cant install better-sqlite3 discord.js 【发布时间】:2019-10-11 20:04:28 【问题描述】:我无法安装 better-sqlite3 我刚刚在我的电脑上重新安装了 Windows 10,我安装了所有东西 (git、node.js、node-gyp)和所有这些东西 当尝试安装 better-sqlite3 时,它会显示这个
> better-sqlite3@5.4.0 install C:\Users\andre\Escritorio\dev\discordbot\node_modules\better-sqlite3
> node-gyp rebuild
C:\Users\andre\Escritorio\dev\discordbot\node_modules\better-sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Los proyectos de esta solución se van a compilar de uno en uno. Para habilitar la compilación en paralelo, agregue el modificador "/m".
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(67,5): error MSB8020: No se p
ueden encontrar las herramientas de compilación para v140 (Conjunto de herramientas de la plataforma = 'v140'). Para compilar con las herramientas d
e compilación v140, instale las herramientas de compilación v140. También puede actualizar a las herramientas actuales de Visual Studio. Para ello,
seleccione el menú Proyecto o haga clic con el botón secundario en la solución y, a continuación, seleccione "Actualizar solución". [C:\Users\andre\
Escritorio\dev\discordbot\node_modules\better-sqlite3\build\deps\locate_sqlite3.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\andre\Escritorio\dev\discordbot\node_modules\better-sqlite3
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN discord.js@11.5.0 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.0 requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.0 requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.0 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.0 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN enmap@4.8.4 requires a peer of better-sqlite-pool@github:eslachance/better-sqlite-pool but none is installed. You must install peer dependencies yourself.
npm WARN discordbot@ No description
npm WARN discordbot@ No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! better-sqlite3@5.4.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@5.4.0 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! C:\Users\andre\AppData\Roaming\npm-cache\_logs\2019-05-25T14_42_59_404Z-debug.log
【问题讨论】:
有什么问题? 【参考方案1】:将此添加到文件 package.json 中,然后检查它是否有效
"main": "index.js", “依赖”: “更好的sqlite3”:“5.4.0”
【讨论】:
【参考方案2】:以管理员身份打开 PowerShell 并运行此 npm i --vs2015 -g windows-build-tools
。之后下载better-sqlite3,应该会成功下载。
【讨论】:
以上是关于无法安装 better-sqlite3 discord.js的主要内容,如果未能解决你的问题,请参考以下文章
Enmap 无法安装,出现 better-sqlite3 错误
错误:找不到绑定文件 better-sqlite3.node
在 Angular + Electron 应用程序中使用 better-sqlite3:模块解析失败:意外字符