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

Multiple (node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. #3828

Open
3 tasks done
eXhumer opened this issue Apr 30, 2024 · 6 comments
Assignees
Labels
package Issues related to the `package` command
Milestone

Comments

@eXhumer
Copy link

eXhumer commented Apr 30, 2024

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

7.4.0

Electron version

v30.0.1

Operating system

macOS 14.4.1 (darwin/arm64)

Last known working Electron Forge version

No response

Expected behavior

No deprecation warning when running package or make scripts.

Actual behavior

Multiple (node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. warnings in console.

For macOS universal builds, I have to use a packageAfterExtract hook to delete a file in macOS application package. For macOS/Windows builds, I am also having to run a postPackage hook modify the package slightly to add a file and for code signing / notarization. With or without these hooks added, I keep getting those warnings multiple times while running package or make scripts, even on a clean npm create electron-app output. I added NODE_OPTIONS=--trace-deprecation to get more information regarding this and all of it seems to be caused by promisifyHooks.

Console output with warnings
(.venv) ➜  exhumer@EXHUMER-MACBOOK-AIR  ~/Projects/exviewer git:(main) ✗ npm run package

> exviewer@1.0.0 package
> electron-forge package

✔ Checking your system
✔ Preparing to package application
✔ Running packaging hooks
  ✔ Running generateAssets hook
  ✔ Running prePackage hook
    ✔ [plugin-webpack] Preparing webpack bundles
      ✔ Preparing native dependencies [0.2s]
      ✔ Building webpack bundles [14s]
✔ Packaging application
  ✔ Packaging for arm64 on darwin [1s]
✔ Running postPackage hook
  ✔ Running postPackage hook from forgeConfig

(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(node:7862) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
(.venv) ➜  exhumer@EXHUMER-MACBOOK-AIR  ~/Projects/exviewer git:(main) ✗ NODE_OPTIONS=--trace-deprecation npm run package

> exviewer@1.0.0 package
> electron-forge package

✔ Checking your system
✔ Preparing to package application
✔ Running packaging hooks
  ✔ Running generateAssets hook
  ✔ Running prePackage hook
    ✔ [plugin-webpack] Preparing webpack bundles
      ✔ Preparing native dependencies [0.2s]
      ✔ Building webpack bundles [14s]
✔ Packaging application
  ✔ Packaging for arm64 on darwin [1s]
✔ Running postPackage hook
  ✔ Running postPackage hook from forgeConfig

(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:243:23)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at Packager.extractElectronZip (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:78:25)
    at async Packager.createApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:103:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at Packager.extractElectronZip (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:78:25)
    at async Packager.createApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:103:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:160:25)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:160:25)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:162:27)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:162:27)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.move (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:293:27)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:14367) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.move (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:293:27)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(.venv) ➜  exhumer@EXHUMER-MACBOOK-AIR  ~/Projects/exviewer git:(main) ✗ NODE_OPTIONS=--trace-deprecation DEBUG=1 npm run package

> exviewer@1.0.0 package
> electron-forge package

✔ Checking your system
❯ Preparing to package application
✔ Preparing to package application
❯ Running packaging hooks
❯ Running generateAssets hook
✔ Running generateAssets hook
❯ Running prePackage hook
❯ [plugin-webpack] Preparing webpack bundles
❯ Preparing native dependencies for arm64
✔ Preparing native dependencies
❯ Building webpack bundles
✔ Building webpack bundles
✔ [plugin-webpack] Preparing webpack bundles
✔ Running prePackage hook
✔ Running packaging hooks
❯ Packaging application
› Determining targets...
❯ Packaging for arm64 on darwin
❯ Copying files
❯ Preparing native dependencies
❯ Finalizing package
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:243:23)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at Packager.extractElectronZip (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:78:25)
    at async Packager.createApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:103:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at Packager.extractElectronZip (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:78:25)
    at async Packager.createApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:103:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
✔ Copying files
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:160:25)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:160:25)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
✔ Preparing native dependencies
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:162:27)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.copyTemplate (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:162:27)
    at async MacApp.buildApp (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:148:5)
    at async MacApp.initialize (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:141:7)
    at async MacApp.create (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/mac.ts:435:5)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
✔ Finalizing package
✔ Packaging for arm64 on darwin
✔ Packaging application
❯ Running postPackage hook
❯ Running postPackage hook from forgeConfig
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.move (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:293:27)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at AsyncFunction.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/@electron-forge/core/src/api/package.ts:49:32)
    at node:internal/util:430:21
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.move (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:293:27)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20) {
  code: 'DEP0174'
}
(node:17870) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.move (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:293:27)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20)
DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at AsyncFunction.<anonymous> (node:internal/util:416:12)
    at /Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:59
    at Array.map (<anonymous>)
    at promisifyHooks (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/hooks.ts:9:27)
    at MacApp.move (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/platform.ts:293:27)
    at async Promise.all (index 0)
    at async packager (/Users/exhumer/Projects/exviewer/node_modules/@electron/packager/src/packager.ts:246:20) {
  code: 'DEP0174'
}
✔ Running postPackage hook from forgeConfig
✔ Running postPackage hook
(.venv) ➜  exhumer@EXHUMER-MACBOOK-AIR  ~/Projects/exviewer git:(main) ✗ 

Steps to reproduce

npm create electron-app electron-app -- --template=webpack-typescript
cd electron-app
npm run package

Additional information

I am using the following forge configuration currently when I get these deprecation warnings.

https://github.com/eXhumer/eXViewer/blob/6cb73d39972add0aff25580b3abf307f3f757979/forge.config.ts

@erickzhao
Copy link
Member

erickzhao commented May 1, 2024

Thanks for reporting this @eXhumer! Looks like this is longstanding behaviour in Packager (the promisifyHooks function was originally added in electron/packager#753) and Forge, but DEP0174 was recently added as a runtime deprecation in Node.js as of v21: nodejs/node@ccca547

Going to move this issue over to the Packager repo (thanks for isolating the root cause) as well.

@erickzhao erickzhao pinned this issue May 1, 2024
@erickzhao erickzhao unpinned this issue May 1, 2024
@erickzhao erickzhao transferred this issue from electron/forge May 1, 2024
Copy link

welcome bot commented May 1, 2024

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@LY1806620741
Copy link

LY1806620741 commented Jul 5, 2024

I get the same problem, Any one Can fix it? But, it seem no effect to main process.

@erickzhao
Copy link
Member

@LY1806620741 I don't think this has an impact on Packager's runtime. If you're running Node.js v21 or higher, they just added a new flag to silence specific warnings.

https://nodejs.org/en/blog/release/v21.3.0#new---disable-warning-flag

@erickzhao erickzhao transferred this issue from electron/packager Jan 30, 2025
@erickzhao erickzhao self-assigned this Jan 30, 2025
Copy link

welcome bot commented Jan 30, 2025

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@erickzhao erickzhao transferred this issue from electron/forge Jan 30, 2025
@erickzhao erickzhao transferred this issue from electron/packager Jan 30, 2025
@erickzhao erickzhao added the package Issues related to the `package` command label Jan 31, 2025
@erickzhao erickzhao added this to the 8.0.0 milestone Jan 31, 2025
@erickzhao
Copy link
Member

Sorry for waffling about by transferring this issue across repos over and over again.

I took a closer look at what needs to be done to fix this (because Node 22 LTS crept up on me and this is happening everywhere).

At a base level, we technically accept async/Promise-based functions in the Packager code already. However, this causes problems with DEP0174 because we blindly apply util.promisify everywhere.

We're at a point in time where people probably want to write async code via Promises, so there isn't really a point in keeping callback compatibility for the future.

Since we're preparing a new major version of Forge as part of our initiative to move ecosystem packages to Node 22, this is probably the best approach for the long term:

  1. Breaking change in Packager to only accept Promise-based hook functions.
  2. Upgrade Packager within Forge and make that a breaking change for Forge 8.

In the short-term, I'm not sure if the effort is worth it to refactor a bunch of our code to use antiquated callback-based asynchronous control flow, so this issue might live here until the next major release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package Issues related to the `package` command
Projects
None yet
Development

No branches or pull requests

3 participants