I've been trying to "package" my Electron Application, using the below script, however when the .exe
is created and I try to run said .exe
I end up with an error listed below.
I feel very stupid asking this; but what is the issue causing this as this is the first time experiencing Electron, ive read through countless documents, stackoverflow questions in relation to my issue with no avail.
electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=images/icon/logo.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"TestApp\" && node installers/windows/createinstaller.js
{
"name": "test",
"version": "1.0.0",
"description": "electron test",
"main": "main.js",
"scripts": {
"start": "electron .",
"installer:mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
"installer:win": "electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=images/icon/test.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"test\" && node installers/windows/createinstaller.js",
"installer:linux": "electron-packager . --overwrite --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds"
},
"authors": [
"Johnty"
],
"license": "MIT",
"dependencies": {
"discord-rich-presence": "0.0.8",
"discord.js": "^12.3.1",
"electron-log": "^4.2.4",
"moment": "^2.27.0",
"node-notifier": "^8.0.0",
"update-electron-app": "^2.0.1",
"web-remote-control": "^1.9.8",
"webhook-discord": "^3.7.5"
},
"devDependencies": {
"axios": "^0.21.0",
"electron": "^10.4.7",
"electron-packager": "^15.1.0",
"electron-winstaller": "^4.0.1"
}
}
electron-packager
's prune
option removes any packages from the final bundle that are listed in the devDependencies
section.
Since axios
is listed there, it is removed from the bundle.
You should put it into the dependencies
section and rebuild the bundle.