Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module electron log #439

Open
JeroenMBooij opened this issue Oct 10, 2024 · 3 comments
Open

Cannot find module electron log #439

JeroenMBooij opened this issue Oct 10, 2024 · 3 comments

Comments

@JeroenMBooij
Copy link

JeroenMBooij commented Oct 10, 2024

in production build I get the error saying Cannot find module electron-log/main when I start the application

image

I have an electron app that is wrapping a Angular app and I use electron-build to build the app

package.json

{
  "version": "2.2.10",
  "keywords": [
    "angular",
    "dotnet",
    "electron",
    "eslint",
    "kestrel",
    "scss",
    "typescript"
  ],
  "main": "app/main.js",
  "private": true,
  "scripts": {
    "start:mac": "npm-run-all -p server:serve:mac electron:serve web:serve",
    "start:win": "npm-run-all -p server:serve:win electron:serve web:serve",
    "start:test:win": "npm-run-all -p server:serve:win web:serve",
    "start:test:mac": "npm-run-all -p server:serve:mac web:serve",
    "start:electron": "npm-run-all -p electron:serve web:serve",
    "web:serve": "ng serve -c web",
    "web:build": "npm run build -- -c web-production",
    "build": "npm run electron:serve-tsc && ng build --base-href ./",
    "build:dev": "npm run build -- -c dev",
    "build:prod": "npm run build -- -c production",
    "electron:serve-tsc": "tsc -p tsconfig.serve.json",
    "electron:serve": "wait-on tcp:4200 && npm run electron:serve-tsc && electron . --serve",
    "electron:local": "npm run build:prod && electron .",
    "electron:build": "npm run build:prod && electron-builder build --publish=never",
    "win": "electron-builder --win --config ./electron-builder.json",
    "postinstall": "electron-builder install-app-deps",
    "post-build": "copyfiles -f ./src/assets/* ./dist/assets",
    "test": "ng test --watch=false",
    "test:e2e": "npx playwright test",
    "test:watch": "ng test",
    "lint": "ng lint",
  },
  "dependencies": {
    "@angular/animations": "^16.2.11",
    "@angular/cdk": "^16.2.10",
    "@angular/common": "^16.2.11",
    "@angular/compiler": "^16.2.11",
    "@angular/core": "^16.2.11",
    "@angular/forms": "16.2.11",
    "@angular/language-service": "16.2.11",
    "@angular/material": "16.2.10",
    "@angular/platform-browser": "^16.2.11",
    "@angular/platform-browser-dynamic": "16.2.11",
    "@angular/router": "16.2.11",
    "@ngbracket/ngx-layout": "16.1.3",
    "ag-grid-angular": "29.0.0",
    "ag-grid-community": "29.0.0",
    "dotenv": "16.3.1",
    "electron-log": "5.2.0",
    "ngx-translate-testing": "6.1.0",
    "rxjs": "7.8.0",
    "three": "0.137.5",
    "tslib": "2.5.3",
    "zone.js": "0.13.3"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "16.0.1",
    "@angular-devkit/build-angular": "16.2.8",
    "@angular-eslint/builder": "16.2.0",
    "@angular-eslint/eslint-plugin": "^16.2.0",
    "@angular-eslint/eslint-plugin-template": "^16.2.0",
    "@angular-eslint/schematics": "16.2.0",
    "@angular-eslint/template-parser": "16.2.0",
    "@angular/cli": "16.2.8",
    "@angular/compiler-cli": "16.2.11",
    "@ngx-translate/core": "14.0.0",
    "@ngx-translate/http-loader": "7.0.0",
    "@playwright/test": "1.38.1",
    "@types/jasmine": "4.0.3",
    "@types/jasminewd2": "2.0.10",
    "@types/node": "18.16.18",
    "@typescript-eslint/eslint-plugin": "^5.59.2",
    "@typescript-eslint/parser": "^5.59.2",
    "concurrently": "8.2.1",
    "conventional-changelog-cli": "2.2.2",
    "electron": "32.1.2",
    "electron-builder": "23.6.0",
    "electron-debug": "3.2.0",
    "electron-reloader": "1.2.3",
    "eslint": "^8.39.0",
    "eslint-config-prettier": "8.5.0",
    "eslint-plugin-import": "2.26.0",
    "eslint-plugin-jsdoc": "39.3.25",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "eslint-plugin-prettier": "4.2.1",
    "jasmine-core": "4.2.0",
    "jasmine-spec-reporter": "7.0.0",
    "karma": "6.4.2",
    "karma-coverage-istanbul-reporter": "3.0.3",
    "karma-electron": "7.2.0",
    "karma-jasmine": "5.1.0",
    "karma-jasmine-html-reporter": "2.0.0",
    "ng-mocks": "14.11.0",
    "node-polyfill-webpack-plugin": "2.0.1",
    "npm-run-all": "4.1.5",
    "playwright": "1.38.1",
    "prettier": "2.8.8",
    "prettier-eslint": "15.0.1",
    "ts-node": "10.9.1",
    "typescript": "4.9.5",
    "wait-on": "6.0.1",
    "webdriver-manager": "12.1.9"
  },
  "engines": {
    "node": ">= 20.16.0"
  }
}

electron-builder.json

{
  "directories": {
  "output": "../output"
  },
  "files": [
  "**/*",
  "!**/*.ts",
  "!**/.vscode",
  "!*.map",
  "!package.json",
  "!package-lock.json",
  "!tsconfig.json",
  "!tslint.json",
  {
  "from": "../dist",
  "filter": ["**/*"]
  }
  ],
  "extraFiles": {
  "from": "../bin/dist/",
  "to": "bin/dist/",
  "filter": ["**/*"]
  },
  "win": {
  "icon": "dist/assets/icons/icon.ico",
  "target": ["nsis"],
  "forceCodeSigning": true,
  "sign": "../CodeSigning/customSign.js"
  },
  "portable": {
  "splashImage": "dist/assets/icons/icon.ico"
  },
  "nsis": {
  "deleteAppDataOnUninstall": true,
  "createDesktopShortcut": true,
  "createStartMenuShortcut": true,
  "shortcutName": "App",
  "artifactName": "App.Setup.${version}.${ext}",
  "uninstallDisplayName": "Uninstall App (${version})",
  "oneClick": false,
  "runAfterFinish": false
  }
}
@megahertz
Copy link
Owner

That's a bundling issue. I need a sample project that reproduces the problem so I can determine what's wrong.

@kogratte
Copy link

I got something very,very, very similar on a nuxt+electron project.Obviously,path are slightly differents, but the error is the exact same.

@kogratte
Copy link

Ok, I got something.

You CANNOT use electron-log from the background process. Anyway, stderr and stdout are redirected if using process.fork or spawn,so,logs ends up in the logfile managed by electron-log.

Remember that the background process should theoretically be runnable as a standalone node program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants