2

I'm taking over an outdated electron-webpack + react app, and my build is always getting this error:

Cannot read file C:\Users\baz\Desktop\foo-bar-app\node_modules\esprima\.bin\esparse: Error: ENOENT: no such file or directory, open 'C:\Users\baz\Desktop\foo-bar-app\node_modules\esprima\.bin\esparse' at w (C:\Users\baz\Desktop\foo-bar-app\node_modules\app-builder-lib\src\asar\asarUtil.ts:201:11) at writeStream.write (C:\Users\baz\Desktop\foo-bar-app\node_modules\app-builder-lib\src\asar\asarUtil.ts:203:43) at afterWrite (_stream_writable.js:480:3) at onwrite (_stream_writable.js:471:7) at lazyFs.write (internal/fs/streams.js:304:5) at FSReqWrap.wrapper [as oncomplete] (fs.js:502:5) error Command failed with exit code 1.

I found that esprima creates symlinks to esparse in it's .bin folder, but trying to open the symlinks in explorer gives an "invalid directory" alert box, so I assume that is related to the ENOENT

Any clue how to resolve this?

Novaterata
  • 4,356
  • 3
  • 29
  • 51
  • 1
    I just hit this today, and it's my first time working with electron-builder. It happened after I installed electron-updater (https://www.npmjs.com/package/electron-updater). It stopped after I uninstalled it. Unfortunately, I need electron-updater. – jpetitte Nov 01 '18 at 20:11
  • Hopefully I'm not being too verbose here, but I'm going to catalog some of my tests in new comments. I just tried setting "asar": false for each platform specific build configuration, but it warned me against not using asar, and then it gave "Error: Cannot cleanup:" followed by similar esprima issues with .bin – jpetitte Nov 01 '18 at 20:40
  • @jpetitte Any help is appreciated. I'll be meeting up with the original maintainer eventually; hopefully, he'll have some insight. – Novaterata Nov 01 '18 at 21:11

1 Answers1

2

This may have something to do with yarn. When I do a yarn install, it adds the symlinked .bin folder to the esprima package. An npm install doesn't. I deleted the node_modules folder, ran npm i, and then yarn dist, and all seemed well.

Let me know how this works for you!

jpetitte
  • 610
  • 5
  • 18
  • That makes sense. I ran the windows and Linux build on Linux and did not get that error, so it's probably a bug with yarn and windows symlinks – Novaterata Nov 02 '18 at 02:14