Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Electron 尝试让nedb导入到一个苗条的组件中_Electron_Svelte_Nedb - Fatal编程技术网

Electron 尝试让nedb导入到一个苗条的组件中

Electron 尝试让nedb导入到一个苗条的组件中,electron,svelte,nedb,Electron,Svelte,Nedb,我有一个基本的Electron/Svelte应用程序,我正在尝试使用nedb添加数据库功能。如果我使用let Datastore=require(“nedb”)我会得到一个错误,“未捕获引用错误:未定义require”。我能找到的最好的建议是使用import,但是使用从'nedb'导入数据存储我得到错误“uncaughtreferenceerror:util未在main.js:6中定义”。想法?找到了。需要在new BrowserWindow()的参数中将nodeIntegration设置为tr

我有一个基本的Electron/Svelte应用程序,我正在尝试使用nedb添加数据库功能。如果我使用
let Datastore=require(“nedb”)
我会得到一个错误,“未捕获引用错误:未定义require”。我能找到的最好的建议是使用import,但是使用
从'nedb'导入数据存储
我得到错误“uncaughtreferenceerror:util未在main.js:6中定义”。想法?

找到了。需要在new BrowserWindow()的参数中将nodeIntegration设置为true

    mainWindow = new BrowserWindow({
        width: 900,
        height: 680,
        webPreferences: {
            nodeIntegration: true
          }
    });