OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

electron app not working with V2

Open hedefalk opened this issue 4 years ago • 9 comments

I'm trying to run desktop version in V2 branch. I've been using the Electron based app a lot since it's the only way I've been able to do node/npm based development.

Expected Behavior

That the Electron apps starts.

Actual Behavior

White screen with the following error:

module.js:487 Uncaught Error: Cannot find module '@jscad/array-utils'
    at Module._resolveFilename (module.js:485:15)
    at Function.Module._resolveFilename (/Users/viktor/dev/projects/OpenJSCAD.org/packages/desktop/node_modules/elec…ctron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/viktor/dev/projects/OpenJSCAD.org/packages/desktop/src/sideEffects/fs.js:8:21)
    at Object.<anonymous> (/Users/viktor/dev/projects/OpenJSCAD.org/packages/desktop/src/sideEffects/fs.js:141:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

Steps to Reproduce the Problem

  1. git checkout V2
  2. yarn desktop

Specifications

  • Version: V2 branch
  • Platform: Mac
  • Environment: node.js/electron

Is there some version I can run? I accidentally checked out origin/V2 right now and kindof lost track where I was before. @kaosat-dev, I know you helped me with this before.

Basically I've been using the the Electron version just as an app by running npm run desktop and I've been doing my designs as node modules. Every once in a while something weird happens and the app hangs though. That just happened and therefore I checked out origin/V2. Unfortunately I lost track of what branch I was using before that was somewhat working so now I'm entirely lost right now :/

Thanks for an awesome project!

hedefalk avatar Mar 25 '20 17:03 hedefalk

Ouch, ok, desktop ignored from bootstrap:

--ignore @jscad/desktop

Man, that was confusing. 'Cos I was trying it out running npm install inside the package first, but then added deps and nothing happened on lerna bootstrap…

hedefalk avatar Mar 25 '20 18:03 hedefalk

I started doing some superficial changes to try to make the electron app start but I'm beginning to realize that there might be a deeper reason this is left unfixed…?

Is there a branch that is more up to date than master but still have a working electron app?

hedefalk avatar Mar 25 '20 21:03 hedefalk

I’ll have to check... but V1 (master branch) should be working.

Or do you want to work with V2? This is now in very early adoption.

z3dev avatar Mar 25 '20 22:03 z3dev

git fetch
git checkout origin/master
git clean -f -d -X
rm -rf ~/Library/Application\ Support/@jscad/
nvm use 10 // dunno  about that, but had issues with 13 I think?
npm run desktop

Desktop app starts! But loading my design gives me:

Error: Uncaught Error: Bad output from script: expected CSG/CAG objects line: 54, filename:file:///Users/viktor/dev/projects/OpenJSCAD-3/packages/desktop/src/core/code-evaluation/rebuildSolidsWorker.js stack: undefined

Which was the reason I started exploring V2 branch.

I'd love to work with V2. I see that vtree is integrated into main repo there which would be nice. I'm currently using https://github.com/kaosat-dev/jscad-tree-experiments as described here:

https://github.com/jscad/OpenJSCAD.org/blob/master/packages/desktop/README.md#how-to-use-it--temporary-instructions

I see these instructions have changed in V2 to use internal vtree deps

hedefalk avatar Mar 26 '20 09:03 hedefalk

Hmm... please return only CSG or CAG objects from your main() function. There might be some else.

z3dev avatar Mar 26 '20 09:03 z3dev

I’m trying to enable the desktop application with V2 now. It’s taking a while as there are still lots of dependencies to update, and some code changes. I’ll let you know when it becomes available again.

z3dev avatar Mar 26 '20 09:03 z3dev

Awesome! Thank you so much for looking into it. I tried myself, but felt I didn't really know what I was doing ;)

https://github.com/hedefalk/OpenJSCAD.org/tree/V2_trying_desktop

On Thu, Mar 26, 2020 at 10:24 AM Z3 Development [email protected] wrote:

I’m trying to enable the desktop application with V2 now. It’s taking a while as there are still lots of dependencies to update, and some code changes. I’ll let you know when it becomes available again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jscad/OpenJSCAD.org/issues/543#issuecomment-604320150, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA4OKHR7PPOKAH7U4D6UUTRJMNM5ANCNFSM4LTT67CA .

hedefalk avatar Mar 26 '20 09:03 hedefalk

OK. I gave it my best shot but the desktop application is going to need a total rework, which @kaosat-dev can only handle.

@hedefalk what other options do you have?

z3dev avatar Mar 27 '20 07:03 z3dev

@z3dev Thanks a lot for giving it a shot!

I've been able to manage running from master up til now. Every once in a while I seem to get into a weird state and I'm not sure what I've done to escape from it but so far I've been able to manage. I've done things as clear the cache and re-checking the "experimental geometry caching see" toggle…

Wow, it seems I've just got it running again from master :) Happy, happy!

image

Ok, this seems to be it then, when I get in a bad state, it seems I just need to:

  • Quit the app
  • clear the cache (/Users/viktor/Library/Application Support/@jscad/desktop)
  • start the app
  • re-check "experimental geometry caching see"

@z3dev I might have forgotten the fourth step this time. Without that caching I get that mentioned error. It seems I can continue using master! Thanks and sorry for taking your time!

hedefalk avatar Mar 27 '20 07:03 hedefalk