Can't run Ghost doctor or Ghost-cli

Keywords: Ghost - AWS - Technical issue - Other

bnsupport ID: ab92c020-fca1-8872-f767-a6facce07056

bndiagnostic output:

? Mariadb: Found possible issues
? Resources: Found possible issues
https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/debug-errors-mariadb/
https://docs.bitnami.com/installer/faq/linux-faq/administration/increase-memory-linux/

bndiagnostic failure reason: The documentation did not make any significant change

Description:
I can’t seem to be able to run ghost doctor or ghost-cli.

When I try, this is what happens:

bitnami@ip-172-26-4-25:~$ cd ~
bitnami@ip-172-26-4-25:~$ ghost doctor
-bash: ghost: command not found
bitnami@ip-172-26-4-25:~$ cd /opt/bitnami/ghost
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ ghost doctor
-bash: ghost: command not found
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ ghost-cli
-bash: ghost-cli: command not found
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ bin/ghost doctor
-bash: bin/ghost: No such file or directory
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ 

and the same goes for Ghost-cli. Any ideas?

Hi @jose.fandos,

You can run the ghost commands using the same command structure we used for running ghost update

sudo su ghost -c "ghost doctor"

For example, in a fresh new machine I’ve just launched

$ sudo su ghost -c "ghost doctor"
βœ” Checking system Node.js version - found v14.17.6
β„Ή Ensuring user is not logged in as ghost user [skipped]
β„Ή Checking if logged in user is directory owner [skipped]
βœ” Checking current folder permissions
βœ” Checking for a MySQL installation
Instance is currently running
β„Ή Validating config [skipped]
βœ” Checking memory availability
βœ” Checking binary dependencies
βœ” Checking free space

Remember to run it from the /opt/bitnami/ghost folder.

Hi again @jose.fandos,

I opened a new task to our documentation team for them to document how to run ghost commands. They will post here any update on this.

1 Like

Here is the thing, though. The β€œghost update” command is not working either. That is after the update, where it worked. And nothing else has been done to this instance. I have only been trying to run Ghost Doctor since, because with the update, I noticed the failure of sending emails β€” an issue with the mailer in Ghost 4.16 that will be fixed in a future version. But anyway, but to this one:

bitnami@ip-172-26-4-25:~$ sudo su ghost -c "ghost doctor"
sh: 1: ghost: not found
bitnami@ip-172-26-4-25:~$ cd /opt/bitnami/ghost
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ sudo su ghost -c "ghost doctor"
sh: 1: ghost: not found
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ cd current
bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ sudo su ghost -c "ghost doctor"
sh: 1: ghost: not found
bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ cd /opt/bitnami/ghost
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ sudo su ghost -c "ghost update"
sh: 1: ghost: not found
bitnami@ip-172-26-4-25:/opt/bitnami/ghost$ cd /opt/bitnami/ghost/current
bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ sudo su ghost -c "npm install ghost-cli"
+ ghost-cli@1.17.3
removed 11 packages, updated 72 packages, moved 2 packages and audited 1748 packages in 106.165s

75 packages are looking for funding
  run `npm fund` for details

found 11 high severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ 

And running an npm audit returned this:

bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ npm audit
npm ERR! code ELOCKVERIFY
npm ERR! Errors were found in your package-lock.json, run  npm install  to fix them.
npm ERR!     Missing: @nexes/nql@0.6.0
npm ERR!     Missing: @sentry/node@6.13.2
npm ERR!     Missing: @tryghost/debug@0.1.5
npm ERR!     Missing: @tryghost/email-analytics-service@1.0.1
npm ERR!     Missing: @tryghost/errors@0.2.14
npm ERR!     Missing: @tryghost/kg-markdown-html-renderer@5.0.5
npm ERR!     Missing: @tryghost/logging@0.1.7
npm ERR!     Missing: @tryghost/magic-link@1.0.12
npm ERR!     Missing: @tryghost/members-csv@1.1.6
npm ERR!     Missing: @tryghost/root-utils@0.3.4
npm ERR!     Missing: @tryghost/string@0.1.20
npm ERR!     Missing: @tryghost/tpl@0.1.4
npm ERR!     Missing: @tryghost/url-utils@2.0.2
npm ERR!     Missing: @tryghost/validator@0.1.5
npm ERR!     Missing: @tryghost/version@0.1.4
npm ERR!     Missing: @tryghost/zip@1.1.15
npm ERR!     Missing: bluebird@3.7.2
npm ERR!     Missing: body-parser@1.19.0
npm ERR!     Missing: bson-objectid@2.0.1
npm ERR!     Missing: bthreads@0.5.1
npm ERR!     Missing: cheerio@0.22.0
npm ERR!     Missing: express@4.17.1
npm ERR!     Missing: express-brute@1.0.1
npm ERR!     Missing: express-hbs@2.4.0
npm ERR!     Missing: fs-extra@10.0.0
npm ERR!     Missing: glob@7.2.0
npm ERR!     Missing: got@9.6.0
npm ERR!     Missing: image-size@1.0.0
npm ERR!     Missing: jsonwebtoken@8.5.1
npm ERR!     Missing: juice@8.0.0
npm ERR!     Missing: lodash@4.17.21
npm ERR!     Missing: mailgun-js@0.22.0
npm ERR!     Missing: moment@2.24.0
npm ERR!     Missing: moment-timezone@0.5.23
npm ERR!     Missing: multer@1.4.3
npm ERR!     Missing: mysql@2.18.1
npm ERR!     Missing: node-jose@2.0.0
npm ERR!     Missing: probe-image-size@5.0.0
npm ERR!     Missing: semver@7.3.5
npm ERR!     Missing: tough-cookie@4.0.0
npm ERR!     Missing: uuid@8.3.2
npm ERR!     Missing: xml@1.0.1
npm ERR!     Missing: @lodder/grunt-postcss@3.0.1
npm ERR!     Missing: c8@7.9.0
npm ERR!     Missing: coffeescript@2.6.0
npm ERR!     Missing: cssnano@5.0.8
npm ERR!     Missing: eslint@7.32.0
npm ERR!     Missing: eslint-plugin-ghost@2.6.0
npm ERR!     Missing: grunt@1.4.1
npm ERR!     Missing: grunt-bg-shell@2.3.3
npm ERR!     Missing: grunt-contrib-clean@2.0.0
npm ERR!     Missing: grunt-contrib-compress@2.0.0
npm ERR!     Missing: grunt-contrib-copy@1.0.0
npm ERR!     Missing: grunt-contrib-symlink@1.0.0
npm ERR!     Missing: grunt-contrib-watch@1.1.0
npm ERR!     Missing: grunt-express-server@0.5.4
npm ERR!     Missing: grunt-shell@3.0.1
npm ERR!     Missing: grunt-subgrunt@1.3.0
npm ERR!     Missing: grunt-update-submodules@0.4.1
npm ERR!     Missing: jwks-rsa@2.0.4
npm ERR!     Missing: mocha@9.1.1
npm ERR!     Missing: mocha-slow-test-reporter@0.1.2
npm ERR!     Missing: mock-knex@0.4.10
npm ERR!     Missing: nock@13.1.3
npm ERR!     Missing: postcss@8.3.7
npm ERR!     Missing: rewire@5.0.0
npm ERR!     Missing: should@13.2.3
npm ERR!     Missing: sinon@11.1.2
npm ERR!     Missing: supertest@6.1.6
npm ERR!     Missing: tmp@0.2.1

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bitnami/.npm/_logs/2021-10-01T12_14_03_833Z-debug.log
bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ 

And the suggested npm install:

bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ npm install
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 checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/kg-markdown-html-renderer
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/logging
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/version
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/zip
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/express-hbs
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/multer
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/sqlite3
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@babel
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/logging/node_modules
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/zip/node_modules
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@types
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@nexes
npm WARN checkPermissions Missing write access to /opt/bitnami/ghost/versions/4.16.0/node_modules/@sentry
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/kg-markdown-html-renderer
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/kg-markdown-html-renderer'
npm ERR!  [Error: EACCES: permission denied, access '/opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/kg-markdown-html-renderer'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/bitnami/ghost/versions/4.16.0/node_modules/@tryghost/kg-markdown-html-renderer'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bitnami/.npm/_logs/2021-10-01T12_16_26_972Z-debug.log
bitnami@ip-172-26-4-25:/opt/bitnami/ghost/current$ 

@gongomgra do you think it could be an issue with folders?

Come to think of it, I never did this, as per the documentation:

Approach A (Bitnami installations using system packages):

sudo chown ghost:bitnami -R /opt/bitnami/ghost
sudo chmod 640 /opt/bitnami/ghost/config.production.json

Hi @jose.fandos,

Thanks for your messages. I launched a fresh new instance using the same Node.js and Ghost version you were previously using, and running the ghost doctor command worked just fine

bitnami@ip-172-31-27-33:/opt/bitnami/ghost$ sudo su ghost -c "ghost doctor"
βœ” Checking system Node.js version - found v14.17.3
β„Ή Ensuring user is not logged in as ghost user [skipped]
β„Ή Checking if logged in user is directory owner [skipped]
βœ” Checking current folder permissions
βœ” Checking for a MySQL installation
Instance is currently running
β„Ή Validating config [skipped]
βœ” Checking memory availability
βœ” Checking binary dependencies
βœ” Checking free space

Updating Ghost after that worked fine as well

bitnami@ip-172-31-27-33:/opt/bitnami/ghost$ sudo su ghost -c "ghost update"
βœ” Checking system Node.js version - found v14.17.3
β„Ή Ensuring user is not logged in as ghost user [skipped]
β„Ή Checking if logged in user is directory owner [skipped]
βœ” Checking current folder permissions
βœ” Checking memory availability
βœ” Checking free space
βœ” Checking for available migrations
βœ” Checking for latest Ghost version

# 4.17.0

* ✨ Added Members Filtering feature - Fabien O'Carroll
* πŸ› Fixed incorrect unsaved changes popup on memberships screen - Rishabh Garg
* πŸ› Fixed mail config not respecting disabled secure connections - Daniel Lockyer

---

View the changelogs for full details:
* Ghost - https://github.com/tryghost/ghost/compare/v4.16.0...v4.17.0
* Admin - https://github.com/tryghost/admin/compare/v4.16.0...v4.17.0

βœ” Fetched release notes
βœ” Downloading and updating Ghost to v4.17.0
βœ” Stopping Ghost
βœ” Linking latest Ghost and recording versions
βœ” Restarting Ghost
β„Ή Removing old Ghost versions [skipped]

And also ghost doctor after the update

bitnami@ip-172-31-27-33:/opt/bitnami/ghost$ sudo su ghost -c "ghost doctor"
βœ” Checking system Node.js version - found v14.17.3
β„Ή Ensuring user is not logged in as ghost user [skipped]
β„Ή Checking if logged in user is directory owner [skipped]
βœ” Checking current folder permissions
βœ” Checking for a MySQL installation
Instance is currently running
β„Ή Validating config [skipped]
βœ” Checking memory availability
βœ” Checking binary dependencies
βœ” Checking free space

I also tried to update the ghost-cli, and ghost doctor keeps working after that

bitnami@ip-172-31-27-33:/opt/bitnami/ghost/current$ sudo su ghost -c "npm install ghost-cli"
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
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 request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated intl-messageformat-parser@2.1.3: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/rimraf as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/rimraf
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/esgenerate as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/escodegen
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/escodegen as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/escodegen
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/nopt as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/nopt
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/mkdirp as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/mkdirp
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/esparse as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/esprima
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/esvalidate as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/esprima
npm WARN rm not removing /opt/bitnami/ghost/versions/4.17.0/node_modules/.bin/acorn as it wasn't installed by /opt/bitnami/ghost/versions/4.17.0/node_modules/acorn

> yarn@1.22.10 preinstall /opt/bitnami/ghost/versions/4.17.0/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)


> dtrace-provider@0.8.8 install /opt/bitnami/ghost/versions/4.17.0/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js

make: Entering directory '/opt/bitnami/ghost/versions/4.17.0/node_modules/dtrace-provider/build'
  TOUCH Release/obj.target/DTraceProviderStub.stamp
make: Leaving directory '/opt/bitnami/ghost/versions/4.17.0/node_modules/dtrace-provider/build'

> sqlite3@5.0.2 install /opt/bitnami/ghost/versions/4.17.0/node_modules/knex-migrator/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
[sqlite3] Success: "/opt/bitnami/ghost/versions/4.17.0/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node" is installed via remote

> sharp@0.29.1 install /opt/bitnami/ghost/versions/4.17.0/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Using cached /home/ghost/.npm/_libvips/libvips-8.11.3-linux-x64.tar.br

> re2@1.16.0 install /opt/bitnami/ghost/versions/4.17.0/node_modules/re2
> install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR || npm run rebuild

Trying https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.br ...
Writing to build/Release/re2.node ...
Done.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN express-brute@1.0.1 requires a peer of express@4.x but none is installed. You must install peer dependencies yourself.

+ ghost-cli@1.17.3
added 589 packages from 303 contributors, removed 130 packages, updated 1094 packages and audited 1756 packages in 118.77s

109 packages are looking for funding
  run `npm fund` for details

found 61 vulnerabilities (20 moderate, 39 high, 2 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

bitnami@ip-172-31-27-33:/opt/bitnami/ghost/current$ cd ..
bitnami@ip-172-31-27-33:/opt/bitnami/ghost$ sudo su ghost -c "ghost doctor"
βœ” Checking system Node.js version - found v14.17.3
β„Ή Ensuring user is not logged in as ghost user [skipped]
β„Ή Checking if logged in user is directory owner [skipped]
βœ” Checking current folder permissions
βœ” Checking for a MySQL installation
Instance is currently running
β„Ή Validating config [skipped]
βœ” Checking memory availability
βœ” Checking binary dependencies
βœ” Checking free space

But I reproduced your errors running npm audit fix, however I ran the npm install command as suggested by audit and ghost doctor keeps working just fine after that. Remember not running npm install as it, but using the sudo su ghost -c "your_command_here" wrapper instead. Can you give it a try?

bitnami@ip-172-31-27-33:/opt/bitnami/ghost/current$ sudo su ghost -c "npm install"
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.

> sqlite3@5.0.2 install /opt/bitnami/ghost/versions/4.17.0/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
[sqlite3] Success: "/opt/bitnami/ghost/versions/4.17.0/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node" is installed via remote
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 540 packages from 773 contributors, updated 78 packages and audited 2312 packages in 67.727s

142 packages are looking for funding
  run `npm fund` for details

found 82 vulnerabilities (32 moderate, 47 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

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