启动我几年前创建的discord机器人时,出现此错误,我不知道是什么原因引起的。我已经完成了node_modules的卸载和重新安装等工作,但是我不确定任何想法可能导致什么错误?
错误:
PS C:\Users\Admin\Documents\Bot> node index.js
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'better-sqlite3'
Require stack:
- C:\Users\Admin\Documents\Bot\node_modules\enmap\src\index.js
- C:\Users\Admin\Documents\Bot\node_modules\enmap\index.js
- C:\Users\Admin\Documents\Bot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at new Enmap (C:\Users\Admin\Documents\Bot\node_modules\enmap\src\index.js:110:24)
at Object.<anonymous> (C:\Users\Admin\Documents\Bot\index.js:5:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Admin\\Documents\\Bot\\node_modules\\enmap\\src\\index.js',
'C:\\Users\\Admin\\Documents\\Bot\\node_modules\\enmap\\index.js',
'C:\\Users\\Admin\\Documents\\Bot\\index.js'
]
}
答案 0 :(得分:1)
首先确保安装了更好的sqlite3
public void StartApplicationInsights(string logType)
{
string appInsightsComponentId = string.Empty;
try
{
telemetryClient = new TelemetryClient();
TelemetryConfiguration.Active.InstrumentationKey = GetConfigvalue("AppInsightsAppId"); ;
TelemetryConfiguration.Active.TelemetryInitializers.Add(new MaskingTelemetryInitializer());
}
catch (Exception exception)
{
// Log Exception to WadLog if logging to Wadlog is enabled
if (logType != LoggingType.Both) return;
WadLogWriter.LogToWadLogs(Logger.BuildErrorString(exception), EventLevel.Error);
}
}
然后就已经定义
npm i better-sqlite3