0

我无法安装 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
4

2 回答 2

0

将此添加到文件 package.json 中,然后检查它是否有效

{

“main”:“index.js”,“依赖项”:{“better-sqlite3”:“5.4.0”}}

于 2019-05-25T14:51:46.677 回答
0

以管理员身份打开 PowerShell 并运行此npm i --vs2015 -g windows-build-tools. 之后下载better-sqlite3,它应该会成功下载。

于 2019-08-01T16:36:16.633 回答