timche / gmail-desktop

:postbox: Nifty Gmail desktop app for macOS, Linux & Windows
MIT License
832 stars 91 forks source link

Cannot find module 'electron-debug' #254

Closed yochananmarqos closed 3 years ago

yochananmarqos commented 3 years ago

Describe the bug Build is failing with 2.25.0, was fine with 2.24.3.

yarn 1.22.10-1 nodejs 15.11.0-1

yarn install --cache-folder "$srcdir/yarn-cache"
yarn compile
yarn build:linux
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info dmg-license@1.0.8: The platform "linux" is incompatible with this module.
info "dmg-license@1.0.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info iconv-corefoundation@1.1.5: The platform "linux" is incompatible with this module.
info "iconv-corefoundation@1.1.5" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "xo > eslint-import-resolver-webpack@0.13.0" has unmet peer dependency "webpack@>=1.11.0".
[4/4] Building fresh packages...
success Saved lockfile.
$ electron-builder install-app-deps
  • electron-builder  version=22.10.5
  • loaded configuration  file=package.json ("build" field)
$ husky install
husky - not a Git repository, skipping hooks installation
Done in 23.16s.
yarn run v1.22.10
$ tsc
src/debug.ts:3:32 - error TS2307: Cannot find module 'electron-debug' or its corresponding type declarations.

3 import electronDebug = require('electron-debug')
                                 ~~~~~~~~~~~~~~~~

Found 1 error.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Desktop (please complete the following information):

timche commented 3 years ago

Can't reproduce it on my machine (macOS, Node v14, Yarn v1) and CI on main is green too. I rather think the error must be on your side. Try clearing your Yarn cache or delete node_modules and re-install.

yochananmarqos commented 3 years ago

I'm building in a clean chroot with a temporary local yarn cache.

timche commented 3 years ago

electron-debug is defined in the package.json and yarn.lock and compiling is working on multiple environments including CI (otherwise releasing v2.25.0 wouldn't have been possible). Unfortunately I can't give you support as this is not an issue with the gmail-desktop project itself (until proven).

yochananmarqos commented 3 years ago

electron-debug is defined in the package.json and yarn.lock

Not in the tarball it's not:

package.json

  "dependencies": {
    "darkreader": "^4.9.27",
    "electron-context-menu": "^2.5.0",
    "electron-dl": "^3.2.0",
    "electron-log": "^4.3.2",
    "electron-store": "^7.0.2",
    "electron-updater": "^4.3.8",
    "electron-util": "^0.14.2",
    "element-ready": "^5.0.0",
    "got": "^11.8.2",
    "p-wait-for": "^3.2.0"

yarn.lock

  dependencies:
    "@babel/code-frame" "^7.12.13"
    "@babel/generator" "^7.13.0"
    "@babel/helper-compilation-targets" "^7.13.8"
    "@babel/helper-module-transforms" "^7.13.0"
    "@babel/helpers" "^7.13.0"
    "@babel/parser" "^7.13.4"
    "@babel/template" "^7.12.13"
    "@babel/traverse" "^7.13.0"
    "@babel/types" "^7.13.0"
    convert-source-map "^1.7.0"
    debug "^4.1.0"
    gensync "^1.0.0-beta.2"
    json5 "^2.1.2"
    lodash "^4.17.19"
    semver "^6.3.0"
    source-map "^0.5.0"
timche commented 3 years ago

There were no changes made to either of them between v2.24.3 and v2.25.0: https://github.com/timche/gmail-desktop/compare/v2.24.3...v2.25.0

What tarball are you referring to? Please provide exact steps to reproduce.

Edit: If you mean https://github.com/timche/gmail-desktop/archive/v2.25.0.tar.gz, then electron-debug is also available there as well:

Screen Shot 2021-03-16 at 17 44 01 Screen Shot 2021-03-16 at 17 44 20

yochananmarqos commented 3 years ago

Sorry, you're right, it was on my end. Somehow my sed lines removed it:

    sed -i '/AppImage/d' package.json
    sed -i '/deb/d' package.json
    sed -i '/rpm/d' package.json
    sed -i '/pacman/d' package.json
    sed -i '/snap/d' package.json
    sed -i 's/tar.bz2/dir/g' package.json

I reverted back to the following and it builds now.

    sed -i '109,113d' package.json
    sed -i 's/tar.bz2/dir/g' package.json
timche commented 3 years ago

Instead of messing with the source code and potentially breaking things, you can directly execute yarn electron-builder target --linux dir --linux tar.bz2 to build your targets.

yochananmarqos commented 3 years ago

Aha! Thanks for the tip.