forge icon indicating copy to clipboard operation
forge copied to clipboard

Third party node module cannot open package.json when packaged

Open rheza opened this issue 7 years ago • 3 comments

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project follows, as appropriate.
  • [X] I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue: I try to package my app with " electron-forge package --arch=x64 --platform=darwin" it successfully packaged my app to App for mac, but when i try to run it, i got package.json not found. https://i.imgur.com/afztAQl.png

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

✔ Checking your system
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
✔ Preparing native dependencies: 1 / 1
✔ Packaging Application

https://i.imgur.com/DgihKQt.png

What command line arguments are you passing?

{
  "name": "super",
  "productName": "super",
  "version": "1.0.0",
  "description": "My Electron application description",
  "main": "src/index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "eslint src --color"
  },
  "keywords": [],
  "author": "rheza",
  "license": "MIT",
  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "npm"
      },
      "electronWinstallerConfig": {
        "name": "supergrin"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "supergrin"
      }
    }
  },
  "dependencies": {
    "app-root-dir": "^1.0.2",
    "electron-compile": "^6.4.4",
    "electron-db": "^0.8.3",
    "electron-reload": "^1.4.0",
    "electron-squirrel-startup": "^1.0.0"
  },
  "devDependencies": {
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "electron-forge": "^5.2.4",
    "electron-prebuilt-compile": "4.0.0",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.12.4"
  }
}

rheza avatar Feb 18 '19 06:02 rheza

In order to debug your problem further, we need a minimal testcase to reproduce your problem. Using the project output by electron-forge init as a base, could you please create a minimal Electron app that illustrates the issue you described, and post a link to it here?

malept avatar Feb 18 '19 07:02 malept

I try the electron-forge init and try to package it. There is no problem, when I try to add all my code to the recently created project, it will get the same error. The source for my electron app is here https://github.com/rheza/SuperGrin

Can anyone help me how to package my app ?,

Thank you

rheza avatar Feb 18 '19 07:02 rheza

This isn't a bug in Electron Forge. Rather, it's a bug in electron-db. It does not seem to support packaged apps - per this FAQ entry, it should not be using a relative path to package.json.

malept avatar Feb 18 '19 07:02 malept