Question:
Remote module of electron introduced into Vue component:
let { remote } = require("electron");
An error is reported when the electron application starts.
solve:
1. Add window before require, that is:
let { remote } = window.require("electron");
2. Add vue.config.js file in the root directory of the project, and the configuration is as follows:
module.exports = {
pluginOptions: {
electronBuilder: {
nodeIntegration: true
}
}
}
The above two methods can be solved.
Of course, the webpreferences property of browserwindow should also be configured correctly:
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
}
Read More:
- Solution to electron error “cannot find module app”
- The Vue parent component uses ref to call the sub component method and reports an error
- Vue introduces ecarts, init initializes and reports an error
- After Vue is packaged, a blank page appears, an error is reported in the resource request, and there is no error handling scheme
- An error is reported when passing data pages using Ajax: Vue is not defined
- The Vue project does not install node sass and an error is reported
- Idea installation vue.js After plug-in, new has no Vue component
- Cannot find module ‘request’ is prompted after electron is packaged
- The Vue project is packaged and deployed to tomcat, and an Error 404 is reported as soon as it is refreshed
- Solve the problem that the tray of electron system disappears automatically
- Vue3. X reports an error using vantui. Failed to resolve component: Van-**-**
- Problems in compiling and using node FFI under electron
- [_ Note] Vue.js reported an error: Cannot read property’validate’ of undefined”
- The version number of robot JS running by electron does not match
- During the development of vue, v-for reported an error [vue/require-v-for-key] Elements in iteration expect to have’v-bind:key’ directives.
- #An error is reported by the chart map component of renfast framework
- Vue failed to log in. F12 reported an error: request failed with status code 404
- Error in created hook: “referenceerror:” promise “undefined” Vue cli project Google is right, ie reported an error, “promise” undefined“
- The Vue project cannot use a component name that contains the word switch
- An error was reported on the command line of Vue when it first wrote a small project: expected indentation of 4 spaces but found 6