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

v22.11.1 intrododuces publishing bug #5861

Closed
mixmix opened this issue May 5, 2021 · 11 comments
Closed

v22.11.1 intrododuces publishing bug #5861

mixmix opened this issue May 5, 2021 · 11 comments

Comments

@mixmix
Copy link

mixmix commented May 5, 2021

Problem

Node: 14.16.1
OS: Linux, MacOS

have noticed the following error with publishing builds with v22.11.1 :

> electron-builder --config build/electron-builder.config.js --publish always

  • cannot check updates  error=TypeError: update_notifier_1.default is not a function
  • electron-builder  version=22.10.5 os=5.4.0-72-generic
  • loaded configuration  file=/home/somename/projects/AHAU/whakapapa-ora/desktop/build/electron-builder.config.js
  • writing effective config  file=dist/installers/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=fd-lock@1.2.0, fsctl@1.0.0, leveldown@5.6.0, sodium-native@3.2.1, utp-native@2.4.0 platform=linux arch=x64
  • packaging       platform=linux arch=x64 electron=12.0.6 appOutDir=dist/installers/linux-unpacked
  • building        target=AppImage arch=x64 file=dist/installers/ahau-desktop-Linux-1.3.1-x86_64.AppImage
  • publishing      publisher=Github (owner: protozoa-nz, project: whakapapa-ora, version: 1.3.1)
  • uploading       file=ahau-desktop-Linux-1.3.1-x86_64.AppImage provider=GitHub
  ⨯ Cannot read property 'getType' of undefined  failedTask=build stackTrace=TypeError: Cannot read property 'getType' of undefined
    at GitHubPublisher.doUploadFile (/home/somename/projects/AHAU/whakapapa-ora/desktop/node_modules/electron-publish/src/gitHubPublisher.ts:190:36)
    at GitHubPublisher.doUpload (/home/somename/projects/AHAU/whakapapa-ora/desktop/node_modules/electron-publish/src/gitHubPublisher.ts:170:23)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at GitHubPublisher.upload (/home/somename/projects/AHAU/whakapapa-ora/desktop/node_modules/electron-publish/src/publisher.ts:87:5)
    at async Promise.all (index 1)
    at AsyncTaskManager.awaitTasks (/home/somename/projects/AHAU/whakapapa-ora/desktop/node_modules/builder-util/src/asyncTaskManager.ts:65:25)
    at PublishManager.awaitTasks (/home/somename/projects/AHAU/whakapapa-ora/desktop/node_modules/app-builder-lib/src/publish/PublishManager.ts:228:5)
    at Object.executeFinally (/home/somename/projects/AHAU/whakapapa-ora/desktop/node_modules/builder-util/src/promise.ts:23:3)

Investigation

Looked at /home/somename/projects/AHAU/whakapapa-ora/desktop/node_modules/electron-publish/src/gitHubPublisher.ts:190:36 and it's saying mime is undefined which is pretty strange

➜  desktop git:(master) npm ls mime --depth 5
ahau-desktop@1.3.1 /home/somename/projects/AHAU/whakapapa-ora/desktop
├─┬ electron-builder@22.11.1
│ └─┬ app-builder-lib@22.11.1
│   └─┬ electron-publish@22.11.1
│     └── mime@2.5.2 deduped

hmmm

Fix

regress to v22.10.5

fluxxu added a commit to w3champions/launcher that referenced this issue May 5, 2021
urshofer added a commit to Rokfor/rokfor-writer that referenced this issue May 5, 2021
@cawa-93
Copy link
Contributor

cawa-93 commented May 6, 2021

I can confirm for Windows: https://github.com/cawa-93/vite-electron-builder/runs/2507942045

@modmoto
Copy link

modmoto commented May 6, 2021

@mixmix
What tool did you downgrade? We tried electron-publish but that did not work

edit:
found the issue, just adding "electron-builder": "22.10.5" to the "devDependencies" worked.

@mixmix
Copy link
Author

mixmix commented May 6, 2021 via email

@cawa-93
Copy link
Contributor

cawa-93 commented May 8, 2021

Ping @develar @mmaietta

@mixmix
Copy link
Author

mixmix commented May 8, 2021 via email

@mmaietta
Copy link
Collaborator

mmaietta commented May 9, 2021

There were a lot of changes between 22.10.5 to 22.11.1, which makes this so much more difficult to triage.
Few changes that I've collected so far that could potentially relate to this.
ts-babel -> tsc
yarn -> pnpm

    "target": "es2018", -> es2019
    "module": "esnext", -> CommonJS

I have no idea how to test to fix this though as I don't have any publisher setups to work with.

Could someone please put together a minimal-reproducing repo/gist?

@cawa-93
Copy link
Contributor

cawa-93 commented May 9, 2021

There were a lot of changes between 22.10.5 to 22.11.1, which makes this so much more difficult to triage.
Few changes that I've collected so far that could potentially relate to this.
ts-babel -> tsc
yarn -> pnpm

    "target": "es2018", -> es2019
    "module": "esnext", -> CommonJS

I have no idea how to test to fix this though as I don't have any publisher setups to work with.

Could someone please put together a minimal-reproducing repo/gist?

You can use my template repo, if this help ...
https://github.com/cawa-93/vite-electron-builder/

@bcomnes
Copy link
Contributor

bcomnes commented May 10, 2021

Could someone please put together a minimal-reproducing repo/gist?

I wrote up the problem in the published package:

#5870 (comment)

Basically, the tests are treating module.exports in mime as a default import, but is treating module.exports as an object of named exports and looking for a default property on that object in the published asset. Since mime doesn't export an object with a default property, you will see these .default is not a function errors wherever a cjs module is imported as a default import.

The solution is:

  • make the ts test and publish config consistent somehow (I have no idea)
  • fix the import syntax to match the config

@mmaietta
Copy link
Collaborator

make the ts test and publish config consistent somehow (I have no idea)

I honestly have no idea either. I also don't have access to publishing the electron-builder package to npm, or know what scripts are running during/for the publish.
CC @develar for access 😉

One approach is to revert to ts-babel so we can isolate the pnpm migration from the compiler changes. Might be at least a safe route since so many changes occurred between 22.10.5 and 22.11.1, which seems to have led to a significant jump in tickets opened

@bcomnes
Copy link
Contributor

bcomnes commented May 10, 2021

I would bet this issue is on the tsc side and not on the pnpm side, since it seems like its a transpilation configuration issue, and not a module install/resolution issue.

@develar
Copy link
Member

develar commented May 10, 2021

Fix: import * as mime from "mime" instead of import mime from "mime". Will be pushed soon.

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

No branches or pull requests

6 participants