# Ghost CLI throws error

**URL:** <https://forum.ghost.org/t/ghost-cli-throws-error/8344>\
**Category:** Developer help\
**Created:** [July 19, 2019, 4:10pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344 "2019-07-19T16:10:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swagmaster](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Swagmaster](https://forum.ghost.org/u/Swagmaster)\
**Post date:** [July 19, 2019, 4:10pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/1 "2019-07-19T16:10:24Z")

</div>

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

> [@Ghost cli shows errors after latest update to 1.11.0](https://forum.ghost.org/t/ghost-cli-shows-errors-after-latest-update-to-1-11-0/7678/4):
>
> It’s all here :) See this section about node: [How to install & setup Ghost on Ubuntu 16.04, 18.04, 20.04 or 22.04](https://docs.ghost.org/install/ubuntu/#install-nodejs)[Supported node versions for self-hosted installs of Ghost](https://docs.ghost.org/faq/node-versions/) You can google these easily :) Have fun!

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.

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [July 19, 2019, 4:23pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/2 "2019-07-19T16:23:27Z")

</div>

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

Which node\_modules did you clear?

---

<div class="post-metadata">

**Author:** ![Swagmaster](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Swagmaster](https://forum.ghost.org/u/Swagmaster)\
**Post date:** [July 19, 2019, 4:26pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/3 "2019-07-19T16:26:48Z")

</div>

`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.

---

<div class="post-metadata">

**Author:** ![Swagmaster](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Swagmaster](https://forum.ghost.org/u/Swagmaster)\
**Post date:** [July 19, 2019, 4:31pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/4 "2019-07-19T16:31:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [July 19, 2019, 4:38pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/5 "2019-07-19T16:38:01Z")

</div>

> [@Swagmaster](#):
>
> `node -v:`  
> 6.11.3

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

---

<div class="post-metadata">

**Author:** ![Swagmaster](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Swagmaster](https://forum.ghost.org/u/Swagmaster)\
**Post date:** [July 19, 2019, 4:40pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/6 "2019-07-19T16:40:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [July 19, 2019, 4:45pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/7 "2019-07-19T16:45:52Z")

</div>

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

> **[How to install & setup Ghost on Ubuntu 16.04, 18.04, 20.04 or 22.04](https://ghost.org/docs/install/ubuntu/#install-nodejs)**
>
> A full production install guide for how to install the Ghost professional publishing platform on a production server running Ubuntu 16.04, 18.04, 20.04 or 22.04.

---

<div class="post-metadata">

**Author:** ![Swagmaster](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Swagmaster](https://forum.ghost.org/u/Swagmaster)\
**Post date:** [July 19, 2019, 4:53pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/8 "2019-07-19T16:53:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [July 19, 2019, 5:01pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/9 "2019-07-19T17:01:45Z")

</div>

> [@Swagmaster](#):
>
> that still keeps the old node executable from the Debian repositories at /usr/local/bin/node

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

---

<div class="post-metadata">

**Author:** ![Swagmaster](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Swagmaster](https://forum.ghost.org/u/Swagmaster)\
**Post date:** [July 19, 2019, 5:05pm UTC](https://forum.ghost.org/t/ghost-cli-throws-error/8344/10 "2019-07-19T17:05:42Z")

</div>

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.
