question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build with codesign takes a long time when 'nodegit' is in my dependencies

See original GitHub issue
  • Version: 11.3.0
  • Target: Mac

Problem:

I am trying to build a project that has nodegit@0.16.0 as a dependency. When I run:

CSC_LINK={mycertfilepath} CSC_KEY_PASSWORD={mypass} build --mac

The build takes a long time (i.e. never finishes). On my MacBook Pro (Retina, Mid 2012) running MacOS Sierra, the “Rebuilding” and “Packaging” steps take ~5 minutes, which is a bit slow. For the “Signing” step, however, I’ve waited 30+ minutes and never seen it finish.

With nodegit deleted from "dependencies", the build finishes in seconds.

Details:

A minimal package.json that reproduces the issue looks like this:

{
  "name": "repro-nodegit-electron-build-demo",
  "version": "0.0.0",
  "private": true,
  "description": "Minimal test of building Electron with nodegit and codesigning",
  "main": "index.js",
  "author": "Matthew",
  "engines": {
    "node": "6.6.0",
    "npm": "3.10.3",
    "electron": "1.4.5"
  },
  "build": {
    "appId": "com.electron.nodegitelectronbuilddemo",
    "copyright": "none",
    "productName": "nodegitelectronbuilddemo",
    "forceCodeSigning": true,
    "electronVersion": "1.4.5",
    "mac": {
      "category": "public.app-category.developer-tools"
    }
  },
  "scripts": {
    "build": "build --mac"
  },
  "dependencies": {
    "nodegit": "0.16.0"
  },
  "devDependencies": {
    "electron-builder": "11.3.0"
  }
}

(To repro the signing slowness, you would need to get a developer certificate, etc.)

Hypotheses:

Based on the output of $ ps ax | grep codesign while running the build, my guess is that there are simply so many files to sign that it is just taking a long time. I see it signing a lot of files that seem ancillary.

With that in mind, these are my hypotheses:

  • I am supposed to somehow pre-bundle my code before using electron-builder. (I.e. concatenate my JavaScript files, etc., so that there are fewer files to sign?)

  • I am supposed to configure the "files" build option so that code-signing doesn’t have to trawl through a bunch of ancillary files. (It looks like nodegit and its dependencies are rather huge, and there are some test/VCS artifacts also being signed.)

  • I have misconfigured the installation of nodegit somehow, resulting in a big complicated bundle.

  • I am supposed to pre-compile nodegit down to a single bundle before using it here.

  • Waiting over 30 minutes in my scenario is normal. This is simply a fact of life I will have to accept if I want to include nodegit in my project.

  • I am supposed to use the two-package.json setup.

Am I onto something with any of these? Any tips or suggestions?

Apologies if I’ve missed some important note in the documentation that pertains to this.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

299reactions
develarcommented, Jan 31, 2017

Solution — do not use npm. Use yarn and execute yarn clean. All junk directories like vendor/libgit2/tests will be removed.

31reactions
andrewluetgerscommented, Oct 24, 2019

Curious if this still applies in 2019? Apparently https://yarnpkg.com/lang/en/docs/cli/autoclean/ is the current command and there are separate packages that can accomplish this for npm users such as https://github.com/tj/node-prune

Read more comments on GitHub >

github_iconTop Results From Across the Web

Codesign really slow since updating to sierra 10.12.1
I removed all the duplicates and kept just one of each, and my code signing time went from 30 seconds per framework down...
Read more >
Ionic package: No matching provisioning profiles found
BUILD TARGET MyTeam.Click OF PROJECT MyTeam.Click WITH CONFIGURATION Debug === Check dependencies. Code Sign error: No matching provisioning ...
Read more >
The code signature version is no longer supported
My build farm was for a time stuck at Xcode 12.4 because some Mac minis couldn't be ... Apple has changed the codesign...
Read more >
All the Electron Docs! | Electron
Updating Dependencies. Electron's version of Chromium is usually updated within one or two weeks after a new stable Chromium version is released, ...
Read more >
How to automatically sign macOS apps using GitHub Actions
If you're not already using Github Actions to build your code, create a ... Running codesign with a new certificate for the first...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found