semver.simplifyRange is not a function

I’m trying to update Joplin for some time now, but I always encounter the following issue:

4444 http fetch GET 200 https://registry.npmjs.org/glob-stream 114ms (cache miss)
4445 timing metavuln:packument:glob-stream Completed in 116ms
4446 notice 
4446 notice New minor version of npm available! 7.17.0 -> 7.19.1
4446 notice Changelog: https://github.com/npm/cli/releases/tag/v7.19.1
4446 notice Run npm install -g npm@7.19.1 to update!
4446 notice 
4447 verbose stack TypeError: semver.simplifyRange is not a function
4447 verbose stack     at Advisory.[calculateRange] (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:191:16)
4447 verbose stack     at Advisory.load (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:148:28)
4447 verbose stack     at Calculator.[calculate] (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js:59:14)
4447 verbose stack     at async Promise.all (index 8)
4447 verbose stack     at async Map.[init] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:180:7)
4447 verbose stack     at async Map.run (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:108:7)
4448 verbose cwd /var/cache/private/pamac/joplin/src/joplin-1.8.5
4449 verbose Linux 5.10.49-1-MANJARO
4450 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--cache" "/var/cache/private/pamac/joplin/src/npm-cache"
4451 verbose node v12.22.0
4452 verbose npm  v7.17.0
4453 error semver.simplifyRange is not a function
4454 verbose exit 1
$ npm list -g
/home/jazz/.npm-global/lib
+-- asar@3.0.3
+-- npm@7.19.1
`-- semver@7.3.5

Any help would be appreciated. Thanks! :slightly_smiling_face:

I’ve learned that npm should be downgraded to v6 in order to use Joplin.
How could I do it safely in Manjaro?

Instead of using a global installation of node - I recommend using a node version manager.

One such version manager is nvm.

1 Like

Thanks for the heads up. I installed node v14 & npm v6 by using nvm and switched to it, but the error is still the same.

$ node -v || node --version
v14.17.3
$ npm --version
6.14.13

By looking at the logs, during installation of Joplin, it still mentions the npm v7.17.0-1 which was installed via pamac:

I have noticed there’s another npm that I tried to install whilst struggling with Joplin in my ~/.npm-global installed with the -g switch.

I know this may be critical for my system and I kindly ask for your guidance (to avoid bricking my Manjaro) - what would be a clean and safe way to reduce those 2 redundant versions of npm/node and keep only the one I just installed via nvm?

Just checking versions:
[pvonbert@frydo bash]$ whereis npm
npm: /usr/bin/npm /usr/share/man/man1/npm.1.gz
npm -v 7.20.0
node -v v16.4.2

npm is this bash script:

#!/usr/bin/env node
require(’…/lib/cli.js’)(process)

and my last joplin installation did also:
[2021-07-17T17:12:39-0400] [ALPM] installed joplin-desktop (2.1.7-1)
[2021-07-17T17:03:55-0400] [ALPM] installed jq (1.6-4)
[2021-07-17T17:03:55-0400] [ALPM] installed oniguruma (6.9.7.1-1)

I don’t know if any of this will help you or muddy the waters more

Joplin is in the AUR (Arch User Repository).

$ whereis npm
npm: /usr/bin/npm /home/jazz/.nvm/versions/node/v14.17.3/bin/npm /usr/share/man/man1/npm.1.gz

$ npm -v
6.14.13
$ node -v
v14.17.3

$ /usr/bin/npm -v
7.17.0
$ /usr/bin/node -v   
v12.22.0
$ /usr/bin/npm list --depth=0
joe@ /home/jazz
+-- @mapbox/node-pre-gyp@1.0.1
`-- semver@7.3.5

jq and oniguruma installed (same versions)

The only difference is that I have multiple npm installed: one is my /usr/bin and the other one in my /home dir via nvm. I tried to delete the /home instance, but there was no improvements. Still the semvers issue. I guess I should not uninstall the one in /usr/bin and install it again, since it may be required by the system?

I’m just trying to decipher why other Manjaro users report they can install Joplin, but I can’t replicate it due to an unknown issue with semver. Even more confusing is that the devs of Joplin claim it can’t be built against npm v7.x, whilst others claim they can.

SemVer 7.3.5 and jq version 1.6 installed but not oniguruma.

$ npm list -g
/usr/lib
├── node-gyp@8.1.0
├── nopt@5.0.0
├── npm@7.20.0
└── semver@7.3.5

while

$ tree -l -L 2 ~/.npm
/home/pvonbert/.npm
├── _cacache
│ ├── content-v2
│ ├── index-v5
│ └── tmp
├── eresolve-report.txt
├── _logs
│ ├── 2021-07-16T21_11_19_664Z-debug.log
│ ├── 2021-07-16T21_12_45_450Z-debug.log
│ ├── 2021-07-16T21_14_08_537Z-debug.log
│ ├── 2021-07-16T21_21_04_190Z-debug.log
│ ├── 2021-07-17T14_33_39_010Z-debug.log
│ ├── 2021-07-17T21_19_34_846Z-debug.log
│ └── 2021-07-17T21_20_21_887Z-debug.log
└── _update-notifier-last-checked

npm -h comments a .npmrc file, which I do not have.

But apart from this, I couldn’t see anything else, sorry Jazz.

Hi Jazz, today there was an update of Joplin to:
Joplin 2.2.1 (prod, linux)

Client ID: 3fcdf7b15183478b9a2342dce86bxxxx
Sync Version: 2
Profile Version: 39
Keychain Supported: No
Revision: bf3f461 (master)
If interested I can send you the output of yay
p

1 Like

Yes, please. I would prefer pamac (if possible), thank you.

I believe this is my main issue that affects hits, so I’ll open another one here (since the definition of the original problem described on top of this page may be misleading):

At least one of the following commands helped me to install joplin-desktop:

$ nvm cache clear
$ nvm exec npm audit fix
$ nvm exec npm install semver
$ pamac install joplin-desktop

I just read your post. Interesting. I mess so much my system that usually I have to clean install it once a year. Maybe that’s why it’s so different!?

$ which npm
/usr/bin/npm

$ npm --version
7.20.0

$ whereis npm
npm: /usr/bin/npm /usr/share/man/man1/npm.1.gz

$ which node
/usr/bin/node

[$ whereis node
node: /usr/bin/node /usr/include/node /usr/share/man/man1/node.1.gz

And nvm is not installed
$ whereis nvm
nvm:

But at least you got Joplin installed, there is always a way (in Linux) :upside_down_face:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.