Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Cannot generate bytecode / pkg fails to run "codesign" utility (even when codesign is present) #1574

Closed

Description

@ryanblock

What version of pkg are you using?

5.5.2

What version of Node.js are you using?

v14.18.2

What operating system are you using?

macOS 12.2.1 (21D62)

What CPU architecture are you using?

x86_64

What Node versions, OSs and CPU architectures are you building for?

node14-macos-x64

Describe the Bug

Running npx pkg fails with the following error:

> [email protected]
> Fetching base Node.js binaries to PKG_CACHE_PATH
  fetched-v14.18.3-macos-x64          [====================] 100%

/Users/ryan/.pkg-cache/v3.2/fetched-v14.18.3-macos-x64-signed: is already signed
> Error! Cannot generate bytecode
  pkg fails to run "codesign" utility. Due to the mandatory signing
  requirement of macOS, executables must be signed. Please ensure the
  utility is installed and properly configured.

However, codesign is indeed installed and available:

⮑  which codesign
/usr/bin/codesign
⮑  codesign
Usage: codesign -s identity [-fv*] [-o flags] [-r reqs] [-i ident] path ... # sign
       codesign -v [-v*] [-R=<req string>|-R <req file path>] path|[+]pid ... # verify
       codesign -d [options] path ... # display contents
       codesign -h pid ... # display hosting paths

(Related: is the fetched-v14.18.3-macos-x64-signed: is already signed line a red herring?)

Expected Behavior

I expect pkg to successfully run or give me a useful, usable error that I can use to fix the issue.

To Reproduce

Steps to reproduce presented above in the bug description; of course happy to narrow down further if you have any ideas on how I can!

Activity

  1. brianunlam commented on Jun 1, 2022

    @brianunlam
    Contributor

    I had the same issue. As a workaround you can go to the source code and add a "-f" flag when they call the codesign utility:

    execFileSync('codesign', ['--sign', '-', executable], { stdio: 'inherit' });

    I started having this issue when I updated my macos version.

  2. ryanblock commented on Aug 9, 2022

    @ryanblock
    Author

    @brianunlam that's a nice workaround, did the trick for me. It's super brittle for obvious reasons, @jesec @leerob any reason not to incorporate this into the codesign call permanently so we can close this issue?

  3. ryota-ka commented on Sep 14, 2022

    @ryota-ka

    $ sed -e s/--sign/-s/ -i ./node_modules/pkg/lib-es5/mach-o.js did the trick for me, FYI.

  4. robertsLando commented on Sep 14, 2022

    @robertsLando
    Contributor
  5. brianunlam commented on Sep 14, 2022

    @brianunlam
    Contributor

    @brianunlam that's a nice workaround, did the trick for me. It's super brittle for obvious reasons, @jesec @leerob any reason not to incorporate this into the codesign call permanently so we can close this issue?

    Here it's the pr

    #1756

  6. github-actions commented on Dec 14, 2022

    @github-actions

    This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

  7. ryanblock commented on Dec 14, 2022

    @ryanblock
    Author

    The issue isn’t stale. It has PR, even. Auto-closing issues is gross.

  8. 134130 commented on Mar 7, 2023

    @134130

    @ryanblock The PR #1756 is merged. You can close this Issue

  9. ryanblock commented on Mar 7, 2023

    @ryanblock
    Author

    @134130 happy to close this as soon as the fix is released to production. (Maintainers ofc can also close it should they see fit!)

  10. ryanblock commented on Mar 11, 2023

    @ryanblock
    Author

    It should be out, yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions