Issues with running the Electron client

I followed the build instructions. Building the tools and the Electron application using npm install worked fine.

npm install logs
[kct@catormac041 0 ~/work/joplin/Tools master {origin/master}|✔]$ npm install
npm WARN tools@1.0.0 No description
npm WARN tools@1.0.0 No repository field.

added 74 packages from 87 contributors and audited 95 packages in 2.331s
found 2 vulnerabilities (1 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details
[kct@catormac041 0 ~/work/joplin/Tools master {origin/master}|✚1]$ cd ../ElectronClient/app/
[kct@catormac041 0 ~/work/joplin/ElectronClient/app master {origin/master}|✚1]$ rsync --delete -a ../../ReactNativeClient/lib/ lib/
[kct@catormac041 0 ~/work/joplin/ElectronClient/app master {origin/master}|✚1]$ npm install

> fsevents@1.2.4 install /Users/kct/data/work/joplin/ElectronClient/app/node_modules/fsevents
> node install

[fsevents] Success: "/Users/kct/data/work/joplin/ElectronClient/app/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> sqlite3@3.1.13 install /Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

[sqlite3] Success: "/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/node-v57-darwin-x64/node_sqlite3.node" is installed via remote

> electron@1.8.7 postinstall /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron
> node install.js


> Joplin@1.0.104 postinstall /Users/kct/data/work/joplin/ElectronClient/app
> node compile-jsx.js && node compile-package-info.js && node ../../Tools/copycss.js --copy-fonts

Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/ClipperConfigScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/ConfigScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/DropboxLoginScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/EncryptionConfigScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/Header.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/IconButton.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/ImportScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/ItemList.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/MainScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/Navigator.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/NoteList.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/NoteStatusBar.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/NoteText.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/OneDriveLoginScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/PromptDialog.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/Root.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/SideBar.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/StatusScreen.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/Toolbar.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/ToolbarButton.jsx...
Compiling /Users/kct/data/work/joplin/ElectronClient/app/gui/ToolbarSpace.jsx...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-win@2.1.1 (node_modules/7zip-bin-win):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-win@2.1.1: wanted {"os":"win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-linux@1.3.1 (node_modules/7zip-bin-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-linux@1.3.1: wanted {"os":"linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})

added 932 packages from 845 contributors and audited 4039 packages in 35.553s
found 12 vulnerabilities (2 low, 9 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

However, I’ve received an error when running yarn dist, but as far as I know this is not necessary for developing, but only to create a package. I will add the error here as well, although it’s just for completeness and should not disract from the real problem. (I won’t complain though, if somebody is able to help with the yarn issue either.)

yarn dist error
yarn run v1.7.0
$ node_modules/.bin/electron-builder
  • electron-builder version=20.14.7
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/electron-builder-effective-config.yaml
  • rebuilding native production dependencies platform=darwin arch=x64
  • rebuilding native dependency name=fsevents
  • rebuilding native dependency name=sqlite3
Error: /Users/kct/bin/node exited with code 1
Error output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.38
node-pre-gyp info using node@8.11.1 | darwin | x64
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and electron@1.8.7 (electron-v1.8 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@3.7.0
gyp info using node@8.11.1 | darwin | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.7.0
gyp info using node@8.11.1 | darwin | x64
gyp info spawn /opt/local/bin/python2
gyp info spawn args [ '/Users/kct/.npm-global/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kct/.npm-global/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kct/.electron-gyp/iojs-1.8.7/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/kct/.electron-gyp/iojs-1.8.7',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kct/.npm-global/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kct/.electron-gyp/iojs-1.8.7/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.7.0
gyp info using node@8.11.1 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make: *** [Release/sqlite3.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kct/.npm-global/lib/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/kct/bin/node" "/Users/kct/.npm-global/bin/node-gyp" "build" "--fallback-to-build" "--module=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64"
gyp ERR! cwd /Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp build --fallback-to-build --module=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/Users/kct/bin/node" "/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3
node-pre-gyp ERR! node -v v8.11.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
error Command failed with exit code 1.

    at ChildProcess.childProcess.once.code (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/builder-util/src/util.ts:252:14)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:567:12)
From previous event:
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/util/yarn.ts:150:27
From previous event:
    at rebuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/util/yarn.js:234:18)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/util/yarn.ts:20:11
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at installOrRebuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/util/yarn.js:68:17)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:451:13
    at Generator.next (<anonymous>)
From previous event:
    at Packager.installAppDependencies (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:415:70)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:365:20
    at Generator.next (<anonymous>)
From previous event:
    at Packager.doBuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:341:39)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:317:52
    at Generator.next (<anonymous>)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:294:133)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:290:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at Packager.build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:248:14)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/index.ts:51:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/index.js:220:17)
    at build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder/src/builder.ts:234:10)
    at then (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder/src/cli/cli.ts:43:24)
    at <anonymous>
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This is the error I see in the console after running run.sh:

module.js:487 Uncaught Error: Cannot find module '/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64/node_sqlite3.node'
    at Module._resolveFilename (module.js:485:15)
    at Function.Module._resolveFilename (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron/dist/E…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/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/sqlite3.js:4:15)
    at Object.<anonymous> (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/sqlite3.js:190:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

I found a related topic, but the proposed solution npm run pack did not work either.

npm run pack error
> Joplin@1.0.104 pack /Users/kct/data/work/joplin/ElectronClient/app
> electron-builder --dir

  • electron-builder version=20.14.7
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/electron-builder-effective-config.yaml
  • rebuilding native production dependencies platform=darwin arch=x64
Error: /Users/kct/bin/node exited with code 1
Error output:
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and electron@1.8.7 (electron-v1.8 ABI) (falling back to source compile with node-gyp)
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make: *** [Release/sqlite3.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kct/.npm-global/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/kct/bin/node" "/Users/kct/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64"
gyp ERR! cwd /Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/kct/bin/node /Users/kct/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/Users/kct/bin/node" "/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3
node-pre-gyp ERR! node -v v8.11.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@3.1.13 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@3.1.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kct/.npm/_logs/2018-08-01T01_31_53_536Z-debug.log

    at ChildProcess.childProcess.once.code (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/builder-util/src/util.ts:252:14)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:567:12)
From previous event:
    at rebuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/util/yarn.js:234:18)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/util/yarn.ts:20:11
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at installOrRebuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/util/yarn.js:68:17)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:451:13
    at Generator.next (<anonymous>)
From previous event:
    at Packager.installAppDependencies (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:415:70)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:365:20
    at Generator.next (<anonymous>)
From previous event:
    at Packager.doBuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:341:39)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:317:52
    at Generator.next (<anonymous>)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:294:133)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:290:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at Packager.build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:248:14)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/index.ts:51:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/index.js:220:17)
    at build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder/src/builder.ts:234:10)
    at then (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder/src/cli/cli.ts:43:24)
    at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Joplin@1.0.104 pack: `electron-builder --dir`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Joplin@1.0.104 pack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kct/.npm/_logs/2018-08-01T01_31_53_589Z-debug.log

yarn dist is actually necessary to build the binary packages (such as SQLite) for use with Electron, so probably that’s what would be building “electron-v1.8-darwin-x64”.

What was the error when you ran yarn dist?

All the errors and logs are in my original post. Click on the lines with the triangle.

Thanks, I missed that. The SQLite module has always been very tricky to get working. I think they provide pre-compiled binary but maybe not for all versions, and sometimes they provide them but then access is denied (like for this one). I will report this on their forum to see if they have a solution.

Ah, ok. You know, when I was looking at the error message, I thought that this is probably something the guys have to fix upstream. But maybe there’s a workaround to specify which URLs to try. Who knows.

Anyhow, let’s see how it goes.

Hello

Are there any news on this? I am not able to build the app with the instructions on BUILD.md.

yarn dist output
$ yarn dist
yarn run v1.9.4
$ node_modules/.bin/electron-builder
  • electron-builder version=20.14.7
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/electron-builder-effective-config.yaml
  • rebuilding native production dependencies platform=linux arch=x64
  • rebuilding native dependency name=sqlite3
Error: /usr/bin/node8 exited with code 1
Error output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.38
node-pre-gyp info using node@8.11.4 | linux | x64
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-linux-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-linux-x64.tar.gz
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and electron@1.8.7 (electron-v1.8 ABI) (falling back to source compile with node-gyp) 
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-linux-x64.tar.gz 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/ebayer/workspace/dev/repos/git/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:77:29)
node-pre-gyp ERR! stack     at emitOne (events.js:116:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:211:7)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:196:12)
node-pre-gyp ERR! stack     at onErrorNT (internal/child_process.js:372:16)
node-pre-gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
node-pre-gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:180:9)
node-pre-gyp ERR! System Linux 4.18.5-1-default
node-pre-gyp ERR! command "/usr/bin/node8" "/home/ebayer/workspace/dev/repos/git/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/ebayer/workspace/dev/repos/git/joplin/ElectronClient/app/node_modules/sqlite3
node-pre-gyp ERR! node -v v8.11.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok 
error Command failed with exit code 1.

I have reported the issue on the node-sqlite3 GitHub page but not sure if this is actually an issue with their package.

For example, Travis can build the package following these instructions and I’ve never had an issue too so it could be a system issue or maybe some problem with software versions that don’t match.

I wonder if it’s some issue with node-gyp. What if you run npm -g i node-gyp and then try to run yarn dist again?

Unfortunately this didn't help. Here's the output of yarn dist:

click me - please ;-)
[kct@catormac041 0 ~/work/joplin/ElectronClient/app master {origin/master}|✔]$ yarn dist
yarn run v1.9.4
$ node_modules/.bin/electron-builder
  • electron-builder version=20.14.7
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/electron-builder-effective-config.yaml
  • rebuilding native production dependencies platform=darwin arch=x64
  • rebuilding native dependency name=fsevents
  • rebuilding native dependency name=sqlite3
Error: /Users/kct/bin/node exited with code 1
Error output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.38
node-pre-gyp info using node@8.11.1 | darwin | x64
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and electron@1.8.7 (electron-v1.8 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/electron-v1.8-darwin-x64.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@8.11.1 | darwin | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@8.11.1 | darwin | x64
gyp info spawn /opt/local/bin/python2
gyp info spawn args [ '/Users/kct/.npm-global/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kct/.npm-global/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kct/.electron-gyp/iojs-1.8.7/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/kct/.electron-gyp/iojs-1.8.7',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kct/.npm-global/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kct/.electron-gyp/iojs-1.8.7/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@8.11.1 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make: *** [Release/sqlite3.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kct/.npm-global/lib/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/kct/bin/node" "/Users/kct/.npm-global/bin/node-gyp" "build" "--fallback-to-build" "--module=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64"
gyp ERR! cwd /Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp build --fallback-to-build --module=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/Users/kct/bin/node" "/Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/kct/data/work/joplin/ElectronClient/app/node_modules/sqlite3
node-pre-gyp ERR! node -v v8.11.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
error Command failed with exit code 1.

    at ChildProcess.childProcess.once.code (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/builder-util/src/util.ts:252:14)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:567:12)
From previous event:
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/util/yarn.ts:150:27
From previous event:
    at rebuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/util/yarn.js:234:18)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/util/yarn.ts:20:11
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at installOrRebuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/util/yarn.js:68:17)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:451:13
    at Generator.next (<anonymous>)
From previous event:
    at Packager.installAppDependencies (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:415:70)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:365:20
    at Generator.next (<anonymous>)
From previous event:
    at Packager.doBuild (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:341:39)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:317:52
    at Generator.next (<anonymous>)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:294:133)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:290:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at Packager.build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/packager.ts:248:14)
    at /Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/src/index.ts:51:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder-lib/out/index.js:220:17)
    at build (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder/src/builder.ts:234:10)
    at then (/Users/kct/data/work/joplin/ElectronClient/app/node_modules/electron-builder/src/cli/cli.ts:43:24)
    at <anonymous>
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

How about if you try to set the libtool path as described there? https://stackoverflow.com/a/38552393/561309

Great, this worked. Now I have to write a wrapper for yarn, because I won’t set this globally.

Thanks again.

I still do not know however, why npm install named the directory on my machine ElectronClient/app/node_modules/sqlite3/lib/binding/node-v57-darwin-x64 and not ElectronClient/app/node_modules/sqlite3/lib/binding/electron-v1.8-darwin-x64.

That’s the reason for the error when running ./run.sh.

Creating a sym link fixes the error, but this is just a workaround. It would be nice to solve the root cause.

It seems that someone had a similar problem when installing joplin via brew.
This really is puzzling.