所以最近我想做一个新的discord.js机器人。我创建了一个新文件夹,运行了"npm i discord.js“和其他模块。然后我输入"npm i quick.db“。这是一个我非常熟悉并想要使用的模块,但随后出现了以下内容:
PS C:\Users\Boris\Documents\CTW Bot> npm i quick.db
> better-sqlite3@7.4.4 install C:\Users\Boris\Documents\CTW Bot\node_modules\better-sqlite3
> prebuild-install || npm run build-release
prebuild-install WARN install No prebuilt binaries found (target=17.1.0 runtime=node arch=x64 libc= platform=win32)
> better-sqlite3@7.4.4 build-release C:\Users\Boris\Documents\CTW Bot\node_modules\better-sqlite3
> node-gyp rebuild --release
C:\Users\Boris\Documents\CTW Bot\node_modules\better-sqlite3>if not defined npm_config_node_gyp (node "C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release ) else (node "C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2015
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS valid versions for msvs_version:
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack at C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Users\Boris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (node:child_process:404:5)
gyp ERR! stack at ChildProcess.emit (node:events:390:28)
gyp ERR! stack at maybeClose (node:internal/child_process:1062:16)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Boris\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\Boris\Documents\CTW Bot\node_modules\better-sqlite3
gyp ERR! node -v v17.1.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! better-sqlite3@7.4.4 build-release: `node-gyp rebuild --release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@7.4.4 build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Boris\AppData\Roaming\npm-cache\_logs\2021-11-18T20_01_38_296Z-debug.log
npm WARN ctw-bot@1.0.0 No description
npm WARN ctw-bot@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! better-sqlite3@7.4.4 install: `prebuild-install || npm run build-release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@7.4.4 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\Boris\AppData\Roaming\npm-cache\_logs\2021-11-18T20_01_39_061Z-debug.log现在我提到了安装discordjs...这是因为我最后一次使用discord.js是版本12 (或11,但不是13),所以当我安装它时,它附带了版本13。我继续运行"node“。在安装所有模块(不包括discord.js)之前,只要在网上看到机器人,它就会告诉我一些大意:
internal/modules/cjs/loader.js:892
throw err;
^
Error: Cannot find module 'node:events'
Require stack:
- C:\Users\Boris\Documents\CTW Bot\node_modules\discord.js\src\client\BaseClient.js结果我得更新node.js所以我更新了。从node.js版本12开始,我一直到版本17,这是一个相当大的飞跃。问题消失了,每个人都很好。然后我继续安装quick.db.是的,剩下的你都知道了。我该怎么做?
发布于 2021-11-19 15:41:49
错误better-sqlite3错误是由于安装没有正确完成而导致的!尝试重新安装程序
第二个也是一样的。
https://stackoverflow.com/questions/70026352
复制相似问题