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 'appdmg' #2807

Closed
3 tasks done
jgunzelman88 opened this issue Apr 18, 2022 · 10 comments
Closed
3 tasks done

Cannot find module 'appdmg' #2807

jgunzelman88 opened this issue Apr 18, 2022 · 10 comments
Labels

Comments

@jgunzelman88
Copy link

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.63

Electron version

v17.4.0

Operating system

12.3.1

Last known working Electron Forge version

No response

Expected behavior

I am trying to build a dmg installer. I install the package and expected it to work since the documentation you provided is pretty limited.

Actual behavior

I installed @electron-forge/maker-dmg then I installed appdmg and verified it was installed but now I still get this error.

`
An unhandled error has occurred inside Forge:
An error occured while making for target: dmg
Cannot find module 'appdmg'
Require stack:

  • /Users/user/Workspaces/personal/PokeTrax/node_modules/electron-installer-dmg/src/index.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/maker-dmg/dist/MakerDMG.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/util/require-search.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/util/plugin-interface.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/util/forge-config.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/api/import.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/api/index.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/cli/dist/electron-forge-make.js
    Error: Cannot find module 'appdmg'
    Require stack:
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/electron-installer-dmg/src/index.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/maker-dmg/dist/MakerDMG.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/util/require-search.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/util/plugin-interface.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/util/forge-config.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/api/import.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/dist/api/index.js
  • /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/cli/dist/electron-forge-make.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at build (/Users/user/user/Workspaces/personal/PokeTrax/node_modules/electron-installer-dmg/src/index.js:121:10)
    at MakerDMG.make (/Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/maker-dmg/src/MakerDMG.ts:32:18)
    at /Users/user/Workspaces/personal/PokeTrax/node_modules/@electron-forge/core/src/api/make.ts:217:31`

Steps to reproduce

Project is Opensource and main is the lastest
https://github.com/jgunzelman88/PokeTrax
just run npm run make

Thanks for the help!!

Additional information

No response

@Boanerges1996
Copy link

I faced a similar issue what I did was install appdmg as a dev dependency and that solved my issue. I think the electron team has to find a fix for it though.

@mahnunchik
Copy link
Contributor

Cannot find module 'appdmg'

I've faced with the same issue. It works without any problem for a while.

@sboudouk
Copy link

Same issue here. Any fix ? Adding appdmg as dev dependency result in node-gyp error.

@mahnunchik
Copy link
Contributor

My workaround is to specify python version for GitHub action:

- uses: actions/setup-python@v4
  with:
    python-version: '3.10'

@s-a
Copy link

s-a commented Apr 8, 2023

Thanks to #2176 (comment) I removed package-lock.json to fix github build action. This is also related to #2176 .

@dtcooper
Copy link

dtcooper commented Nov 4, 2023

My workaround is to specify python version for GitHub action:

- uses: actions/setup-python@v4
  with:
    python-version: '3.10'

Using Python 3.11 instead of the bundled Python 3.12 fixed it for me using the macos-11 runner with GitHub actions. (My relevant commit that fixed it for reference.)

Appears related to LinusU/node-appdmg#234 and nodejs/node-gyp#2869

MichalGniadek added a commit to CommE2E/comm that referenced this issue Nov 10, 2023
Summary:
[ENG-5678](https://linear.app/comm/issue/ENG-5678)

The general error that breaks the github CI is the same as in this [issue](electron/forge#2807) - `distutils` was removed in a newer version of python and so one of the dependencies postinstall script breaks because of that. This diff fixes that by additionaly installing an older (3.10) version of python before installing the dependencies.

Note that I'm still not sure why the CI is sometimes successful but I'm hoping this should fix the errors.

INFO: Most native (written in C++) js modules are built with something called `node-gyp`. It's written in python and used at build time in postinstall scripts. That's why we need to mess with python.

Test Plan: Tested on a GitHub fork. Without this changes CI failed. After this changes tried running it 3 times and it succeded every time.

Reviewers: atul, ashoat, tomek

Reviewed By: ashoat

Subscribers: wyilio

Differential Revision: https://phab.comm.dev/D9760
xwcoder added a commit to xwcoder/emo that referenced this issue Nov 13, 2023
Try to resolve appdmg module can not found issue in ci/cd pipeline
electron/forge#2807 (comment)
@blee-tetrascience
Copy link

This was driving me crazy today trying to track down. Thanks for posting this @dtcooper. Locking in Python 3.11 did the trick

@dtcooper
Copy link

Glad it helped! @blee-tetrascience :)

@hata6502
Copy link

hata6502 commented Feb 21, 2024

I've resolved this issue on macos-latest by adding python3 -m pip install setuptools at the first step.

    steps:
      # https://github.com/electron/forge/issues/2807
      - run: python3 -m pip install setuptools

      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci

image

@jgresham
Copy link

It looks like GHA mac runner has installed brew and python in some new way which is now giving an error. The --break-system-packages flag fixes the error for me (I don't use python for other things in my actions) so my command is now: python3 -m pip install setuptools --break-system-packages

New error:

Run python3 -m pip install setuptools
  python3 -m pip install setuptools
  shell: /bin/bash -e {0}
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a Python library that isn't in Homebrew,
    use a virtual environment:
    
    python[3](https://github.com/NiceNode/nice-node/actions/runs/8803883604/job/24163039602#step:2:3) -m venv path/to/venv
    source path/to/venv/bin/activate
    python3 -m pip install xyz
    
    If you wish to install a Python application that isn't in Homebrew,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. You can install pipx with
    
    brew install pipx
    
    You may restore the old behavior of pip by passing
    the '--break-system-packages' flag to pip, or by adding
    'break-system-packages = true' to your pip.conf file. The latter
    will permanently disable this error.
    
    If you disable this error, we STRONGLY recommend that you additionally
    pass the '--user' flag to pip, or set 'user = true' in your pip.conf
    file. Failure to do this can result in a broken Homebrew installation.
    
    Read more about this behavior here: <https://peps.python.org/pep-0[6](https://github.com/NiceNode/nice-node/actions/runs/8803883604/job/24163039602#step:2:7)68/>

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 66[8](https://github.com/NiceNode/nice-node/actions/runs/8803883604/job/24163039602#step:2:9) for the detailed specification.
Error: Process completed with exit code 1.

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

No branches or pull requests

9 participants