app-builder icon indicating copy to clipboard operation
app-builder copied to clipboard

Error: ENOENT: no such file or directory, scandir '[project]/node_modules/auto-launch/node_modules/applescript'

Open kxxt opened this issue 2 years ago • 5 comments

Hi,

Thanks for maintaining this project.

I am using the latest app-builder built from the master branch. I encountered the following error when building element-desktop on both x64 and riscv64 architectures:

yarn run v1.22.19
$ yarn run build:ts && yarn run build:res && electron-builder
$ tsc
$ ts-node scripts/copy-res.ts
  • electron-builder  version=24.6.4 os=6.1.52-1-lts
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=linux arch=x64 electron=26.2.0 appOutDir=dist/linux-unpacked
  ⨯ ENOENT: no such file or directory, scandir '/home/kxxt/Workspaces/arch-riscv/repos/element-desktop/node_modules/auto-launch/node_modules/applescript'  failedTask=build stackTrace=Error: ENOENT: no such file or directory, scandir '/home/kxxt/Workspaces/arch-riscv/repos/element-desktop/node_modules/auto-launch/node_modules/applescript'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

In this case, applescript is located in [project-dir]/node_modules instead of [project-dir]/node_modules/auto-launch/node_modules.

Everything works fine on commit c92c3a2 but it starts to fail on commit 6c7d1e1. So it suggests that this bug is caused by #89.

kxxt avatar Sep 12 '23 14:09 kxxt

If a package (such as applescript) contains CLI binaries, Yarn/PNPM would symlink applescript to [project-dir]/node_modules/auto-launch/node_modules instead, not [project-dir]/node_modules

and yes, it caused by #89.

miaulightouch avatar Sep 13 '23 10:09 miaulightouch

@rxliuli, could you please take a look at this issue? It could cause the same problem if electron-updater is listed in the dependencies.

miaulightouch avatar Sep 13 '23 10:09 miaulightouch

@rxliuli, could you please take a look at this issue? It could cause the same problem if electron-updater is listed in the dependencies.

I'll check this out later and see how bundle tools like esbuild resolve dependency conflicts

rxliuli avatar Sep 14 '23 02:09 rxliuli

Running into this issue with electron-builder unit tests when trying to upgrade to 4.2.0 https://github.com/electron-userland/electron-builder/pull/7774

  ● posix smart unpack

    ENOENT: no such file or directory, scandir '/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-2ACDjf/test-project-9/node_modules/are-we-there-yet/node_modules/core-util-is'

Easy way to reproduce the same error (with significantly smaller dependency tree) is running electron-builder test case

TEST_FILES=HoistedNodeModuleTest pnpm run test-linux  

I believe this PR introduced the issue https://github.com/develar/app-builder/pull/89

Could someone please assist?

mmaietta avatar Feb 14 '24 03:02 mmaietta

Run into a similar problem due to npm hoisted module. Please see (https://github.com/develar/app-builder/issues/105).

fabienr avatar Feb 21 '24 22:02 fabienr