Fatal error: [Error: An unknown error occurred.]

Operating system

macOS on M2 Max

Joplin version

3.0.1

Node version

v20.17.0

What issue do you have?

Fatal error trying to run joplin cli. Not sure how to troubleshoot this. I ran the install commands on another Mac and it works. I need it to work on this one though.

gotham:~ abosio$ NPM_CONFIG_PREFIX=~/.joplin-bin npm install -g joplin
npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm warn deprecated @types/nanoid@3.0.0: This is a stub types definition. nanoid provides its own type definitions, so you do not need this installed.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm warn deprecated npmlog@5.0.1: This package is no longer supported.
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated are-we-there-yet@3.0.1: This package is no longer supported.
npm warn deprecated npmlog@6.0.2: This package is no longer supported.
npm warn deprecated gauge@4.0.4: This package is no longer supported.
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated gauge@3.0.2: This package is no longer supported.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported.
npm warn deprecated highlight.js@9.12.0: Version no longer supported. Upgrade to @latest
npm warn deprecated highlight.js@9.12.0: Version no longer supported. Upgrade to @latest

added 25 packages, removed 35 packages, and changed 757 packages in 31s

98 packages are looking for funding
  run `npm fund` for details
npm notice
npm notice New patch version of npm available! 10.8.2 -> 10.8.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
npm notice To update run: npm install -g npm@10.8.3
npm notice
gotham:~ abosio$ sudo ln -s ~/.joplin-bin/bin/joplin /usr/local/bin/joplin
Password:
ln: /usr/local/bin/joplin: File exists
gotham:~ abosio$ joplin
Fatal error:
[Error: An unknown error occurred.]

Still struggling to figure this out. No ideas out there?

What does ls -l ~/.joplin-bin/bin/joplin print, what is this file linked to?

You need to find where "main.js" is, then run it manually using node main.js and see what error message you get, which hopefully will be clearer than the unknown error you're having now

lrwxr-xr-x  1 abosio  staff  34 Sep  8 16:48 /Users/abosio/.joplin-bin/bin/joplin -> ../lib/node_modules/joplin/main.js

so I went there and ran it...

$ node main.js
Fatal error:
[Error: An unknown error occurred.]

so then I discovered a verbose output...very verbose...but not very helpful. here is the tail...

$ NODE_DEBUG=cluster,net,http,fs,tls,module,timers node main.js
...snip...
@joplin/lib/locales/uk_UA.json"
MODULE 11486: Module._load REQUEST ./vi.json parent: /Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/index.js
MODULE 11486: RELATIVE: requested: ./vi.json from parent.id /Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/index.js
MODULE 11486: looking for ["/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales"]
MODULE 11486: load "/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/vi.json" for module "/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/vi.json"
MODULE 11486: Module._load REQUEST ./zh_CN.json parent: /Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/index.js
MODULE 11486: RELATIVE: requested: ./zh_CN.json from parent.id /Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/index.js
MODULE 11486: looking for ["/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales"]
MODULE 11486: load "/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/zh_CN.json" for module "/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/zh_CN.json"
MODULE 11486: Module._load REQUEST ./zh_TW.json parent: /Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/index.js
MODULE 11486: RELATIVE: requested: ./zh_TW.json from parent.id /Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/index.js
MODULE 11486: looking for ["/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales"]
MODULE 11486: load "/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/zh_TW.json" for module "/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/@joplin/lib/locales/zh_TW.json"
Fatal error:
[Error: An unknown error occurred.]

Maybe I should just reinstall? What's the best way to start clean?

I tried deleting /joplin/node_modules in that dir and running npm i, which seemed to work but running joplin gave the same error.

I just realized I accidentally put the wrong hardware in the original post. This is on the last Intel mac mini.

It seems to be a low level error, before Joplin is even started. Maybe try to uninstall Node and reinstall the latest version (22)

I'm using nvm. I thought the lts v20 would be safer, but I switched to v22 and that seems to have created a new problem.

$ joplin
(node:19413) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Fatal error:
[Error: An unknown error occurred.]
$ node --trace-deprecation main.js
(node:19454) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
    at loadBuiltinModule (node:internal/modules/helpers:108:7)
    at Module._load (node:internal/modules/cjs/loader:1099:17)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/Users/abosio/.joplin-bin/lib/node_modules/joplin/node_modules/markdown-it/lib/index.js:14:20)
Fatal error:
[Error: An unknown error occurred.]

Same error actually. It's just that node 20 has more useless warnings.

I wonder if there's some node.js log you could check somewhere on your computer about the error? It wouldn't be the Joplin log because the app doesn't even start

I don't think node.js creates any logging other than what is output to the console when running.

My end goal was to have this running on my mac Mini to write an a script to make weekly backups in a few of Joplin's export formats and then have that end up on my Synology where it will also backup to B2. At this point I may set that up on my Raspberry Pi homelab instead, but it does bug me that I can't get it working on the mac Mini. (I already have Joplin CLI working on my Macbook Pro but that is my work laptop, so I don't want the personal stuff there.)

Maybe on the macOS Console there will be an entry with the crash log?