我已经在discord.js上创建了一个discord机器人。我想使用Quick.db制作数据库。我已经安装了Quick.db并且成功了。
但是,当我想启动我的机器人时,出现了此错误消息。
Error: Cannot find module 'better-sqlite3'
Require stack:
- C:\Users\Thomas\Documents\lester\node_modules\quick.db\bin\handler.js
- C:\Users\Thomas\Documents\lester\node_modules\quick.db\index.js
因此,我测试了使用以下命令安装Better-sqlite3:npm i better-sqlite3
,但是我遇到了这个问题:
C:\Users\Thomas\Documents\lester\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 )
Les projets sont générés individuellement dans cette solution. Pour activer la génération en parallèle, ajoutez le commutateur "/m".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: Les outils de génération pour v140 (ensemble d'outils de plateforme = 'v140')
sont introuvables. Pour générer à l'aide des outils de génération v140, installez les outils de génération v140. Vous avez également la possibilité de mettre à niveau les outils Visual Studio actuels en sélectionnant
le menu Projet ou en cliquant avec le bouton droit sur la solution, puis en sélectionnant "Recibler la solution". [C:\Users\Thomas\Documents\lester\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\Community\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 6.1.7601
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\Thomas\Documents\lester\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.1 requires a peer of bufferutil@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 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.1 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.1 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN lester@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! better-sqlite3@5.4.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@5.4.1 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\Thomas\AppData\Roaming\npm-cache\_logs\2019-07-28T14_29_59_886Z-debug.log
我唯一的问题是,在重建npm之后,但没有任何工作。
你能帮我吗?我已经安装了vsc v140。
答案 0 :(得分:0)
如果您使用的是Windows,请运行npm i --vs2015 -g windows-build-tools
,如果您使用的是Linux,请运行sudo apt-get install build-essential
。