What dev environment and tools do you use?

Hello,

what operating system do you develop on? Linux?
Since the development script is named run.sh, i assume it's not Windows. (Which is my platform of choice, so I'll at least try to get it running here.)

Has anyone done this already?

(ps: thanks for the forum, @laurent! Yay!)
(pps: also, first!!!11 :wink: )

1 Like

I use a bit of a strange hybrid environment at the moment. I develop under Windows but with WSL for the Posix env. Due to the currently buggy nature of WSL, I install the node runtime, Electron, etc. as native apps under Windows, and then launch them from WSL.

In other words, I run things like ā€œnpm installā€, ā€œyarn distā€, etc. from the Windows Command, and ā€œrun.shā€ (which runs the native Windows executable) from WSL.

In general the recommanded environment is Linux I guess since all the tools work better under this OS, but itā€™s do-able to make it work under Windows.

1 Like

Thanks. That's exactly what I wanted to try, so I'll go with that for now.

(For me, Linux is still a pain from the perspective of user comfort, so I avoid it when I can. :innocent: )

Same here, I like the Posix environment in general but not too keen on existing Linux desktop env.

1 Like

I think I messed something up already, so I'm starting over. :sweat_smile:

I made a clean install of the WSL, deleted the entire repo and cloned it again.

I do have node and npm installed on my Windows machine, with nothing installed on WSL Ubuntu except the Fish shell.

So how should I proceed now? Follow the build steps for Windows on Windows, then try running run.sh on WSL after everything is installed and all packages restored?
Am I perhaps missing a step somewhere?

That seems correct and should work. What error are you getting?

I no longer have the exact message handy; it was something to the effect of some package not being available or correct and it suggested (directly in the error message) that I delete node_modules and reinstall.
So that's what I did, but from within WSL this time. (Since I had a clean install of everything and it didn't work.)

Also I had to install nodejs (and npm) within WSL, because npm didn't seem to work.

Now I'm getting this error:

ElectronClient> ./run.sh

> Joplin@1.0.83 compile joplin/ElectronClient/app
> node compile-jsx.js && node compile-package-info.js && node ../../Tools/copycss.js --copy-fonts

joplin/ElectronClient/app/node_modules/electron/dist/electron: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

When I tried googling, I found a suggestion that I install libgtk, which I just did with sudo apt-get install -y libgtk2.0-0.

Not sure it helped, but it definitely did something, since now I'm getting

> Joplin@1.0.83 compile joplin/ElectronClient/app
> node compile-jsx.js && node compile-package-info.js && node ../../Tools/copycss.js --copy-fonts

joplin/ElectronClient/app/node_modules/electron/dist/electron: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory

I guess I could try installing packages and see what happens. :tipping_hand_woman:

Okay, so I kept at it until I had these installed:

libxtst6
libx11-xcb1
libgtk2.0-0
libxss1
libgconf-2-4
libnss3
libasound2

No errors now, but it still doesn't work. Now I get this:

> Joplin@1.0.83 compile joplin/ElectronClient/app
> node compile-jsx.js && node compile-package-info.js && node ../../Tools/copycss.js --copy-fonts

nothing happens and the script finishes and exits. :confused:

Is there any log file that could reveal something useful ?

I think itā€™s because you did npm install from WSL while you need to do it from Windows. Basically all the tools (npm install, yarn dist, electron, etc.) must be on Windows side and installed from cmd.exe. WSL is just a convenience from which you run the native Windows tools.

However if you do npm install on WSL side that will install a Linux version and so youā€™ll also need GTK etc. and Iā€™m not sure youā€™ll manager to get it working.

Well, color me surprised.

This was the first thing I tried and it didn't work; but now that I wiped node_modules again and installed again from Windows, it works. For some reason. :tipping_hand_woman: Thanks.

But after the app starts, I only get a blank window, like this:

What am I doing wrong?

Looks like thereā€™s an error. If you open the Console tab, what does it say?

Uncaught Error: Cannot find module 'D:\Projects\joplin\ElectronClient\app\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64\node_sqlite3.node'
    at Module._resolveFilename (module.js:470:15)
    at Function.Module._resolveFilename (D:\Projects\joplin\ElectronClient\app\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\Projects\joplin\ElectronClient\app\node_modules\sqlite3\lib\sqlite3.js:4:15)
    at Object.<anonymous> (D:\Projects\joplin\ElectronClient\app\node_modules\sqlite3\lib\sqlite3.js:190:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)

Seems like Iā€™m missing a module, somehow?

I think you need to run yarn dist once on the Windows side to get electron-builder to compile all the native libs like SQLite. After that normally it should work.

It did. Thanks again.

BTW from what I can see, both npm and yarn are dependency managers. Why use both?
(Iā€™m not criticizing your design; I just honestly donā€™t know what their roles are.)

Good question - I would prefer to use npm only but electron-builder only supports yarn. We also cannot use yarn only because it has a bug that prevents the equivalent of ā€œnpm installā€ to work on this project.

1 Like

Any suggestions how to get a working dev env on macOS?

Disclaimer: Iā€™m not a JS developer, but itā€™s never too late to learn something newā€¦

follow chapter macOS here then

  • Building the tools
  • Building the Electron application

Thanks @foxmask. I saw that a while back, but Iā€™m using MacPorts and not brew. Thus it would be great, if there were just minimum version requirements in that file.

e.g. is yarn 1.6.0 ok? (which is available via MacPorts)

Also, since Iā€™m not familiar with JS application development: Is there an IDE that shows you the GUI components while working on the code (like in Xcode)? Letā€™s say I want to change a certain GUI component, I click on it, and it will jump right to the relevant JS codeā€¦

I think it should work with whatever is the latest version of node, npm and yarn on MacPorts. If it does not, please post here and Iā€™ll update the Readme.