Ghost CLI throws error

Basically I’m having the same issue as the person in this topic, but his solution did nothing for me:

My URL is internal
I was on 1.21 prior to attempting the upgrade. I think I still a,
I am using (trying to use) npm to install ghost-cli

I found out someone prior upgraded to node 12 on that server, which messed up the installation.
I was on node 4 prior.
After finding this out, I downgraded to node 10.16, installed npm 6.9.0 and installed ghost-cli using
sudo npm i -g ghost-cli@latest
Then I tried to issue ghost update from the install directory only for that to throw the following:

`/usr/local/lib/node_modules/ghost-cli/lib/command.js:108
static async _run(commandName, argv = {}, extensions) {
^^^^

SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/ghost-cli/lib/bootstrap.js:6:17)`

I’ve tried clearing node_modules to no success. Any input will be appreciated.

What do node -v, npm -v and npm bin root output for you?

Which node_modules did you clear?

node -v:
6.11.3

npm -v:
6.9.0

npm bin root:
/mnt/drive/www/html/ghost/node_modules/.bin

I cleared /usr/local/lib/node_modules/

I suspect the issue is that ghost-cli uses node to call nodejs and not nodejs. Since Debian apparently separates the two, I just symlinked nodejs to node and I am currently trying again.

Yes, that appears to have been the issue.
I would suggest that this is mentioned in the setup/update page as it is something that could waste time trying to track down.

How are you managing your node versions? With the nodesource method, the correct command is node, not nodejs. From what I know, nodejs is legacy

I use the nodesource repository, yes.

I used apt install nodejs to install as apt install node returns no package of that name and apparently, that still keeps the old node executable from the Debian repositories at /usr/local/bin/node

The docs cover using nodesource and state that anything else can cause problems:

But I am using it.
I just figured it’d be useful to have a note saying to check the output of node -v as there might be a non-nodesource installation prior.
Sorry, its probably just me.

I’m not sure I understand what you’re saying, but here’s some clarification…

As per the docs, you need to sudo apt install nodejs after you run the nodesource setup script,
but if you want to run node the executable is node - e.g. node run.js

You’re saying you downgraded from node 12 to 10, but you have node 6, which suggests there might be some other method you used to install node that’s still here

Yes, I assume whoever installed node before me installed it though the Debian repositories. I then removed the nodejs package, added nodesource and installed nodejs, but me removing nodejs initially, did not remove node as well. That is the problem.