vue-cli-plugin-electron-builder icon indicating copy to clipboard operation
vue-cli-plugin-electron-builder copied to clipboard

Application entry file "background.js" in the "....app.asar" does not exist

Open Flavsditz opened this issue 2 years ago • 2 comments

Ok, I am losing my mind on this one. xD

My problem, it seems, that the background.ts file is not even being compiled to the dist_electron/bundled folder. Serve works fine... but build does not. It was working for some time, but then suddenly (probably after updates on deps ) the dev-tools stopped working. So I managed to fix it. Then serve broke, I fixed that... now build stopped working...

Here is my env: Node v16.13.0 NPM v8.12.2

Here is my package.json

{
  "name": "test-tool",
  "version": "1.0.0",
  "private": true,
  "description": "Test.",
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:unit": "vue-cli-service test:unit",
    "lint": "vue-cli-service lint",
    "electron:build": "vue-cli-service electron:build",
    "electron:generate-icons": "electron-icon-builder --input=./public/icon.png --output=build --flatten",
    "electron:serve": "vue-cli-service electron:serve",
    "postinstall": "electron-builder install-app-deps",
    "postuninstall": "electron-builder install-app-deps"
  },
  "main": "background.js",
  "dependencies": {
    "axios": "^0.27.2",
    "core-js": "^3.16.4",
    "electron-store": "^8.0.2",
    "exceljs": "^4.3.0",
    "jsonwebtoken": "^8.5.1",
    "lodash": "^4.17.21",
    "vue": "^2.6.14",
    "vue-class-component": "^7.2.6",
    "vue-property-decorator": "^9.1.2",
    "vue-router": "^3.5.1",
    "vuex": "^3.6.2"
  },
  "devDependencies": {
    "@types/electron-devtools-installer": "^2.2.0",
    "@types/lodash": "^4.14.182",
    "@typescript-eslint/eslint-plugin": "^5.4.0",
    "@typescript-eslint/parser": "^5.4.0",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-plugin-router": "~5.0.0",
    "@vue/cli-plugin-typescript": "~5.0.0",
    "@vue/cli-plugin-vuex": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "@vue/eslint-config-typescript": "^9.1.0",
    "autoprefixer": "^10.4.7",
    "electron": "^16.0.0",
    "electron-devtools-installer": "^3.1.0",
    "electron-icon-builder": "^2.0.1",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-vue": "^8.0.3",
    "lint-staged": "^11.1.2",
    "postcss": "^8.4.14",
    "prettier": "^2.7.1",
    "prettier-plugin-tailwindcss": "^0.1.11",
    "tailwindcss": "^3.1.4",
    "ts-loader": "~8.2.0",
    "typescript": "~4.5.5",
    "vue-cli-plugin-electron-builder": "^3.0.0-alpha.4",
    "vue-template-compiler": "^2.6.14"
  },
  "gitHooks": {
    "pre-commit": "lint-staged"
  },
  "lint-staged": {
    "*.{js,jsx,vue,ts,tsx}": [
      "vue-cli-service lint",
      "git add"
    ]
  }
}

and here is the vue.config.js:

module.exports = {
  configureWebpack: {
    devtool: "source-map",
  },
  devServer: {
    port: 8888,
  },
  pluginOptions: {
    electronBuilder: {
      nodeIntegration: true,
      removeElectronJunk: false,
    },
  },
};

Here is the file structure that gets generated upon build: dist_electron ├── bundled │   ├── css │   ├── favicon.ico │   ├── fonts │   ├── icon.png │   ├── img │   ├── index.html │   ├── index.js │   ├── index.js.LICENSE.txt │   ├── js │   ├── node_modules │   └── package.json

I know there was a similar issue (#118) but I went through the entire thread and none of those were my issues. I am sincerely at a loss at the moment. Anything else I can provide? I appreciate the help

Flavsditz avatar Jul 01 '22 06:07 Flavsditz

You are using v3 alpha. You have to remove the main field from your package.json to fix that. See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/1637#issuecomment-1006978695

pschucker avatar Jul 24 '22 21:07 pschucker

hey have you managed to fixed it I am getting similar issue here is my vue.config.js

module.exports = {
    
    pluginOptions: {
        electronBuilder: {
            //outputDir: '../dist_electrons',
            preload: './src/preload.js',
            // Or, for multiple preload files:
            // preload: { preload: 'src/preload.js', otherPreload: 'src/preload2.js' }
            builderOptions: {
                appId: 'com.linerai.liner',
                afterSign: "./afterSignHook.js",
                "extraResources": [{
                    "from": process.env.BACKEND_BUILD_PATH , 
                    "to": "core",
                    "filter": [
                        "**/*",
                        "!dist_electron${/*}"
                    ]
                }],
                "files": [
                    "**/*"
                  ], // access via path.join(path.dirname(__dirname), 'liner_core' );
                "win": {
                    "icon" : "build/Icon-1024.png" , 
                    "target": {
                        "target": "NSIS",
                        "arch": [
                            process.arch   
                        ]
                    }
                },
                "mac": {
                    "icon" : "build/Icon-1024.png" , 
                    "hardenedRuntime": true,
                    "entitlements": "build/entitlements.mac.plist",
                    "entitlementsInherit": "build/entitlements.mac.plist",
                    "minimumSystemVersion": "12.3.0",
                    "extendInfo": {
                        "LSMinimumSystemVersion": "12.3.0"
                    } , 
                    
                    "target": {
                        "target": "dmg",
                        "arch": [
                            "arm64"  //'arm64' , 'x64'
                        ]
                    }
                }
            }


        }
    }
}

and here is my package.json

{
  "name": "ClownIdea",
  "version": "1.5.1",
  "build_number": "0016",
  "website": "https://clownidea.com",
  "description": "ClownIdea - Stable Diffusion App.",
  "is_dev": false,
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "serve:ui": "vue-cli-service serve ./src/main_demoui.js",
    "build:ui": "vue-cli-service build ./src/main_demoui.js",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "electron:build": "vue-cli-service electron:build",
    "electron:serve": "vue-cli-service electron:serve",
    "postinstall": "electron-builder install-app-deps",
    "postuninstall": "electron-builder install-app-deps"
  },
  "main": "background.js",
  "dependencies": {
    "@codekraft-studio/vue-record": "^0.0.3",
    "@fortawesome/fontawesome-svg-core": "^6.2.1",
    "@fortawesome/free-solid-svg-icons": "^5.15.4",
    "@fortawesome/vue-fontawesome": "^2.0.6",
    "apexcharts": "^3.33.0",
    "bootstrap": "^5.1.3",
    "bootstrap-vue": "^2.21.2",
    "chart.js": "^2.9.4",
    "core-js": "^3.6.5",
    "electron-context-menu": "^3.5.0",
    "electron-localshortcut": "^3.2.1",
    "electron-notarize": "^1.2.1",
    "electron-settings": "^4.0.2",
    "fuse.js": "^6.6.2",
    "javascript-time-ago": "^2.3.13",
    "konva": "^8.3.13",
    "nsfwjs": "^2.4.2",
    "v-click-outside": "^3.1.2",
    "vue": "^2.6.11",
    "vue-apexcharts": "^1.6.2",
    "vue-chartjs": "^3.5.1",
    "vue-click-outside": "^1.1.0",
    "vue-inline-svg": "^2.1.0",
    "vue-spinner": "^1.0.4",
    "vue-toast-notification": "^0.6.3",
    "vue-unicons": "^3.3.1",
    "vue-web-cam": "^1.9.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "electron": "^13.0.0",
    "electron-builder": "^23.3.3",
    "electron-devtools-installer": "^3.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-cli-plugin-electron-builder": "~2.1.1",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

When I extracted app.asrar I have only node_modules and no other files

ZahidServers avatar Dec 03 '22 07:12 ZahidServers