#use electron store

1 messages · Page 1 of 1 (latest)

nimble atlas
#

hey , i try to use electron store for create a simple config :
i have try this :

const { contextBridge, ipcRenderer } = require("electron");
const Store = require("electron-store");
const store = new Store();

contextBridge.exposeInMainWorld("api", {
  ipcRenderer: {
    send: (channel, data) => ipcRenderer.send(channel, data),
    on: (channel, func) =>
      ipcRenderer.on(channel, (event, ...args) => func(...args)),
    invoke: (channel, args) => ipcRenderer.invoke(channel, args),
  },
  store: {
    getStoreValue: (key) => store.get(key),
    setStoreValue: (key, value) => store.set(key, value),
    deleteStoreValue: (key) => store.delete(key),
  },
});

```but i have this error : 
VM4 sandbox_bundle:2 Error: module not found: electron-store
    at preloadRequire (VM4 sandbox_bundle:2:82852)
    at <anonymous>:3:15
    at runPreloadScript (VM4 sandbox_bundle:2:83516)
    at VM4 sandbox_bundle:2:83813
    at VM4 sandbox_bundle:2:83968
    at ___electron_webpack_init__ (VM4 sandbox_bundle:2:83972)
    at VM4 sandbox_bundle:2:84095
my package.json : 
```json

{
  "name": "pocketmine_server_tool",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "electron ."
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "devDependencies": {
    "electron": "^30.0.9"
  },
  "dependencies": {
    "@xterm/xterm": "^5.5.0",
    "electron-store": "^9.0.0",
    "xterm": "^5.3.0"
  }
}```
#

i have the same probleme for electron-json-storage

brittle forum