Electron NSIS install creates 2 home folders


Windows 10
Electron 1.6.11
electron-builder 19.45.4

The NSIS installer initially installs my entire electron project in 2 (duplicate) folders, C:\myApp and C:\myApp\resources\app - as you’ll see at the bottom of this email in the installer.nsh file, I copy the app files).
I want my Electron application to run from C:\myApp.

Yet when I click my icon to execute the Electron app, is runs from C:\Home\resources\app. I know this is “normal” but …how can I get my app to run from C:\myApp? All my HTML files assume the application lives in C:\myApp when I do the development.

File: package.json

“name”: “myApp”,
“version”: “1.2.3”,
“description”: “myApp”,
“author”: “myApp guy”,
“license”: “GNU”,
“main”: “main.js”,
“build”: {
“appId”: “myApp”,
“productName”: “myApp”,
“asar”: false,
“files”: [
“win”: {
“target”: [
“icon”: “icons/ico/myApp.ico”
“nsis”: {
“installerIcon”: “icons/ico/myApp.ico”,
“uninstallerIcon”: “icons/ico/myApp.ico”,
“oneClick”: false,
“allowToChangeInstallationDirectory”: true,
“license”: “LICENSE”,
“runAfterFinish”: true,
“include”: “build/installer.nsh”
“scripts”: {
“pack”: “build --dir”,
“dist”: “build”,
“postinstall”: “install-app-deps”,
“electron”: “electron .”
“devDependencies”: {
“electron”: “^1.6.11”,
“electron-builder”: “^19.45.4”,
“fluent-ffmpeg”: “^2.1.2”
“dependencies”: {
“asar”: “^0.14.0”,
“bluebird”: “^3.5.1”,
“bootstrap”: “^3.3.7”,
“bootstrap-dialog”: “^1.34.6”,
“extract-zip”: “^1.6.6”,
“fs”: “0.0.1-security”,
“jquery”: “^3.2.1”,
“jsdom”: “^11.3.0”,
“mysql”: “^2.15.0”,
“string-search”: “^1.2.0”,
“sybase”: “^1.2.1”

File: installer.nsh

!macro preInit
SetRegView 64
WriteRegExpandStr HKLM “{INSTALL_REGISTRY_KEY}" InstallLocation "C:\myApp" WriteRegExpandStr HKCU "{INSTALL_REGISTRY_KEY}” InstallLocation "C:\myApp"
SetRegView 32
WriteRegExpandStr HKLM “{INSTALL_REGISTRY_KEY}" InstallLocation "C:\myApp" WriteRegExpandStr HKCU "{INSTALL_REGISTRY_KEY}” InstallLocation “C:\myApp”

Function .onInstSuccess
SetOutPath "$INSTDIR"
CopyFiles “$INSTDIR\resources\app*” "$INSTDIR"

I guess another way to look at this is – if there is no better choice then to accept that my application will be deployed to the installation directory (which is chosen by the user at installation time), how can I develop my HTML/CSS/Javascript code (files) such that my paths all use install_dir\resources\app?
e.g C:\myApp\resources\app\

Thank you


I am just going to update all my JavaScript files to include the current directory, which will be install_dir\resources\app.
Seems to work fine.