Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module 'conf' #241

Closed
ifzm opened this issue Nov 27, 2022 · 5 comments
Closed

Cannot find module 'conf' #241

ifzm opened this issue Nov 27, 2022 · 5 comments

Comments

@ifzm
Copy link

ifzm commented Nov 27, 2022

I use electron-builder to build the package successfully, but this error appears when I run it, what could be the reason? thanks )

@ifzm
Copy link
Author

ifzm commented Nov 27, 2022

image

@ifzm ifzm closed this as completed Dec 1, 2022
@irg1008
Copy link

irg1008 commented Feb 8, 2023

Why did you closed it and not provide the solution?

@SSmJaE
Copy link

SSmJaE commented Feb 13, 2023

Reason

The readme claims

Initializer to set up the required ipc communication channels for the module when a Store instance is not created in the main process and you are creating a Store instance in the Electron renderer process only.

But I believed it might be working only under the premise that nodeIntergration is false

Since electron-store is merely a wrapper for conf to make it appropriate for electron, initRenderer may employ some tricks to make it work properly (possibly only when nodeIntergration is false)

So when nodeIntergration is true, initRenderer results in the error Cannot find module "conf"

Solution

Because we have turn nodeIntergration on, there is no longer a requirement for electron-store, we can utilize conf directly in renderer process, and main process doesn't require any specific imports

@Yeuoly
Copy link

Yeuoly commented Sep 11, 2023

you should use

import electronStore from 'electron-store'

instead of using

const electronStore = require('electron-store')

@ifzm
Copy link
Author

ifzm commented Sep 12, 2023

Why did you closed it and not provide the solution?

I have this problem because I use it in the renderer, it should be related to the post-build, I later changed to ipc no problem @irg1008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants