Joplin CLI installation on Debian unstable

Hello,

I am trying to install joplin-cli on debian unstable, but running into issues.
Versions:
Debian: unstable
nodejs: 12.19.0 installed from unstable
npm: 7.2.0 installed from unstable
joplin: 1.4.9 (Latest), I also tried installing as joplin@1.0.166 (which is the terminal version that works on an ubuntu 16.04 machine) but that also didn't work.

When I run NPM_CONFIG_PREFIX=$HOME/.joplin-bin npm install -g joplin, I get:

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path /home/sarp/.joplin-bin
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, lstat '/home/sarp/.joplin-bin'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sarp/.npm/_logs/2020-12-19T18_53_19_157Z-debug.log

The full log is below:
2020-12-19T18_53_19_157Z-debug.log (173.5 KB)

I browsed the forum for similar issues. Running npm cache verify and sudo npm cache verify did not resolve the issue. I am not knowledgeable with node so apologies if there is something simple here, and appreciate all the help.

npm should create the directory, but apparently it doesn't.

You are using very new versions of npm and node. You can try to create the "missing" directory:

mkdir /home/sarp/.joplin-bin

However, if it errors out during such a simple operation, who knows what else might be broken. I'd try the versions below to see if it works with those.

Btw, I'm using the following versions on macOS and these versions do work:

$ npm --version
6.14.9
$ node --version
v14.15.0

Thank you for the quick response. After tinkering around and reading through this and this, I decided to use nvm to install node and npm instead of using the debian unstable package. The other option was to fix the permissions for /usr/lib/nodejs after installing the package, which I did not prefer.

I have the same problem on an raspberry pi 4 with raspbian. As described above, I installed node and npm with nvm (not from apt). But I still get the following errors:

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path /home/pi/.joplin-bin
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, lstat '/home/pi/.joplin-bin'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-12-28T19_09_55_180Z-debug.log

My system:
Node: v15.5.0
NPM: 7.3.0

Thanks for any advice.