我一直在尝试自托管一个 TypeScript Discord 机器人,但设置过程令人困惑。我认为它应该使用 build
文件创建一个 index.js
目录,但我不确定。我安装了 Visual Studio Build Tools 2017,因为它似乎需要它们,但运行 npm install
会出现以下错误:
> sodium@3.0.2 preinstall C:\Users\fang2\Documents\Coding\Discord Bots\Myu-Bot-master\node_modules\sodium
> node install.js --preinstall
MS Version: 2017
C:\Users\fang2\Documents\Coding\Discord Bots\Myu-Bot-master\node_modules\sodium\install.js:312
console.log('Invalid msvs_version ' + msvsVersion + '\n');
^
ReferenceError: msvsVersion is not defined
at errorInvalidMSVSVersion (C:\Users\fang2\Documents\Coding\Discord Bots\Myu-Bot-master\node_modules\sodium\install.js:312:43)
at checkMSVSVersion (C:\Users\fang2\Documents\Coding\Discord Bots\Myu-Bot-master\node_modules\sodium\install.js:329:9)
at Object.<anonymous> (C:\Users\fang2\Documents\Coding\Discord Bots\Myu-Bot-master\node_modules\sodium\install.js:353:5)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sodium@3.0.2 preinstall: `node install.js --preinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sodium@3.0.2 preinstall 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\fang2\AppData\Roaming\npm-cache\_logs\2021-06-01T04_30_07_597Z-debug.log
我尝试了 2019 构建工具和 2017 构建工具,并尝试手动设置 msvs 版本,但似乎没有任何效果。任何帮助将不胜感激。