A JavaScript Occur error in main Process ( Cannot find Modules { resource..\main.js}) after Build Electron Windows app


#1

Hello,
Currently I’m using Angular 4 with electron. The application is successfully run on Local server :4200 but when i’m build using electron-package its give me error. No error in building the .exe. when i’m open the exe file its give me error
A JavaScript Occur error in main Process
Cannot Find Modules

Package.json
{
“name”: “”,
“version”: “0.0.1”,
“description”: “”,
“main”: “main.js”,
“scripts”: {
“watch”: “npm run watch:dev”,
“watch:dev”: “webpack --watch --progress --profile”,
“build”: “npm run build:dev”,
“build:dev”: “webpack --progress --profile”,
“package”: “node package.js”,
“package-all”: “npm run package – --all”,
“electron”: “electron .”,
“webpack-test”: “webpack --config webpack.test.js --progress --profile”,
“test”: “karma start”
},
“dependencies”: {
"": “^4.1.0”,
"": “^4.1.0”,
"": “^4.1.0”,
"":“4.2.3”,
"": “^4.1.0”,
"": “^4.1.0”,
"": “^4.1.0”,
"": “^2.0.0-beta.4”,
"": “^4.1.0”,
"": “^4.1.0”,
"": “^4.1.0”,
"": “^4.1.0”,
"": “^1.2.0”,
"": “^2.2.1”,
“copy-webpack-plugin”: “^4.0.1”,
“core-js”: “^2.4.1”,
“electron”: “^1.4.3”,
“hammerjs”: “^2.0.8”,
“rxjs”: “^5.2.0”,
“webpack-target-electron-renderer”: “^0.4.0”,
“zone.js”: “^0.8.5”
},
“devDependencies”: {
"":"^1.1.1",
"":“4.2.3”,
"": “^2.0.33”,
"": “^2.2.34”,
"": “^0.2.32”,
"": “^8.0.0”,
"": “^0.5.0”,
"": “^2.0.27”,
"": “^3.0.0”,
“angular2-template-loader”: “^0.6.0”,
“awesome-typescript-loader”: “^3.0.0-beta.18”,
“codelyzer”: “^3.0.0”,
“css-loader”: “^0.28.0”,
“electron-packager”: “^8.1.0”,
“es6-promise-loader”: “^1.0.1”,
“extract-text-webpack-plugin”: “^2.0.0”,
“file-loader”: “^0.11.0”,
“npm run packimports-loader”: “^0.7.0”,
“istanbul-instrumenter-loader”: “^2.0.0”,
“jasmine-core”: “^2.4.1”,
“json-loader”: “^0.5.4”,
“karma”: “^1.3.0”,
“karma-chrome-launcher”: “^2.0.0”,
“karma-coverage”: “^1.0.0”,
“karma-jasmine”: “^1.0.2”,
“karma-mocha-reporter”: “^2.0.0”,
“karma-phantomjs-launcher”: “^1.0.0”,
“karma-remap-coverage”: “^0.1.4”,
“karma-sourcemap-loader”: “^0.3.7”,
“karma-webpack”: “2.0.2”,
“node-sass”: “^4.0.0”,
“phantomjs-polyfill”: “0.0.2”,
“phantomjs-prebuilt”: “^2.1.7”,
“raw-loader”: “0.5.1”,
“reflect-metadata”: “0.1.10”,
“remap-istanbul”: “^0.9.0”,
“rimraf”: “^2.5.2”,
“sass-loader”: “^6.0.1”,
“source-map-loader”: “^0.2.1”,
“style-loader”: “^0.18.1”,
“svg-url-loader”: “^2.0.0”,
“ts-helpers”: “^1.1.1”,
“tsconfig-lint”: “^0.12.0”,
“tslint”: “^5.0.0”,
“tslint-loader”: “^3.2.0”,
“typescript”: “~2.3.1”,
“url-loader”: “^0.5.7”,
“webpack”: “2.3.3”,
“webpack-dev-middleware”: “^1.10.0”,
“webpack-dev-server”: “2.5.0”
},
“engines”: {
“node”: “>= 4.2.1 <= 6”,
“npm”: “>= 3”
},
“keywords”: [
“healthcare”
]
}

Main.js
/**

Include our app
*/
const {app, BrowserWindow } = require(‘electron’);
// browser-window creates a native window
let mainWindow = null;

app.on(‘window-all-closed’, () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== ‘darwin’) {
app.quit();
}
});

const createWindow = () => {
// Initialize the window to our specified dimensions
mainWindow = new BrowserWindow({ width: 1200, height: 900 });

// Tell Electron where to load the entry point from
mainWindow.loadURL(‘file://’ + __dirname + ‘/src/app/index.html’);

// Open the DevTools.
mainWindow.webContents.openDevTools();
// Clear out the main window when the app is closed
mainWindow.on(‘closed’, () => {
mainWindow = null;
});
};

app.on(‘ready’, createWindow);

app.on(‘activate’, () => {
// On macOS it’s common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
}
});

Please help me out from here I’m getting this issue in all application which is build using electron
Thank You
Vijay Ijardar


#3

did you find any solution? i m also stuck here