Message: An error occurred

I cant start my ghost.
I restart my Mac, when I start my ghost by “ghost start -D”,but an error occurred.
I don’t know what to do, can you help?
Here’s the log:

Debug Information:
OS: Mac OS X, v10.13.3
Node Version: v6.9.0
Ghost-CLI Version: 1.5.2
Environment: development
Command: ‘ghost start -D’
Message: An error occurred.
Stack: Error: An error occurred.
at ChildProcess.cp.on (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/lib/utils/local-process.js:63:35)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at process.nextTick (internal/child_process.js:744:12)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

type ghost status to see if your ghost already run

I’ve tried ghost status, it’s stopped

Could you try updating to the latest version of Ghost-CLI, and then running ghost doctor?

Hopefully it’ll hint at what’s wrong, or at least the location of the log. The error you’re seeing right now doesn’t really tell us anything useful :frowning:

Thank you~
I’ve updated my Ghost-CLI, and there was still something wrong.
The ghost doctor said every thing is OK…
I have 2 ghosts installed in my Mac in different folders, all stoped.
here’s my operation and feedback:

~/Website/ghost ᐅ ghost doctor
:heavy_check_mark: Checking system Node.js version
:heavy_check_mark: Checking current folder permissions
:heavy_check_mark: Validating config
:heavy_check_mark: Checking memory availability
~/Website/ghost ᐅ ghost start
:heavy_check_mark: Checking current folder permissions
:heavy_check_mark: Validating config
:heavy_check_mark: Checking memory availability
:heavy_multiplication_x: Starting Ghost
A GhostError occurred.

Message: An error occurred.

Debug Information:
OS: Mac OS X, v10.13.4
Node Version: v6.9.0
Ghost-CLI Version: 1.7.0
Environment: production
Command: ‘ghost start’

Can you please try running ghost run to see if this works or gives you errors, and also ghost log -f if run still didn’t output a proper message?

Thank you~
here‘s the message:
~/Website/ghost ᐅ ghost run
The ghost run command is used by the configured Ghost process manager and for debugging. If you’re not running this to debug something, you should run ghost start instead.
~/Website/ghost ᐅ ghost log -f
An error occurred.
Message: ‘Cannot read property ‘replace’ of undefined’

Debug Information:
OS: Mac OS X, v10.13.4
Node Version: v6.9.0
Ghost-CLI Version: 1.7.0
Environment: production
Command: ‘ghost log -f’

this is the log file detail
Debug Information:
OS: Mac OS X, v10.13.4
Node Version: v6.9.0
Ghost-CLI Version: 1.7.0
Environment: production
Command: ‘ghost log -f’
An error occurred.
Message: ‘Cannot read property ‘replace’ of undefined’

Stack: TypeError: Cannot read property ‘replace’ of undefined
at instance.running.then (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/lib/commands/log.js:43:102)
at tryCatcher (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)

If still can not solve the problem,I’ll give up…
This is not the first time my ghost went wrong, I reinstalled a ghost in another folder to continue my theme developing. Now it was almost done.
Than you for all your team members’ help in the past days on slack and forum.

You are also using nvm if I see this correctly. This is not recommended:

https://docs.ghost.org/docs/install#section-install-node-js

1 Like

If you’re using Ghost for theme development, you should always install Ghost with ghost install local. This should not run into any problem and you can also use it with nvm on your local machine.

https://docs.ghost.org/docs/install-local

I see, thank you.
I uninstalled the old ghost and run ghost start -D in the new ghost folder,
the error message is:Message: Ghost process exited with code: 0

Is this error message useful for you and can we solve the problem?

when you uninstall ghost, you should first install it again with ghost install local to work with theme development. You don’t need a production blog for theme development.

~/Website/ghost ᐅ ghost status
┌───────────────┬─────────────────┬─────────┬─────────┬─────┬──────┬─────────────────┐
│ Name │ Location │ Version │ Status │ URL │ Port │ Process Manager │
├───────────────┼─────────────────┼─────────┼─────────┼─────┼──────┼─────────────────┤
│ ghost-local-1 │ ~/Website/ghost │ 1.22.1 │ stopped │ n/a │ n/a │ n/a │
└───────────────┴─────────────────┴─────────┴─────────┴─────┴──────┴─────────────────┘

Sorry, I think my ghost environment is ‘development’;
I removed the production config file.
when I run ghost start -D, the debug message is that and I don’t know if helps.

Debug Information:
OS: Mac OS X, v10.13.4
Node Version: v6.9.0
Ghost-CLI Version: 1.7.0
Environment: development
Command: ‘ghost start -D’
Message: Ghost process exited with code: 0
Stack: Error: Ghost process exited with code: 0
at ChildProcess.cp.on (/Users/xcnzhang/.nvm/versions/node/v6.9.0/lib/node_modules/ghost-cli/lib/utils/local-process.js:56:24)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

At last, really thanks for your confidence.

@jimmy Code 0 often means something is OK, but in this case it looks like something else is not OK.

From the link Aileen provided:

NVM can be problematic

If you installed node via nvm, we highly recommend that you uninstall nvm. There have been several people who have run into permission problems, because they’ve installed nvm in /root or /home, which is a local installation of node. Ghost requires a system wide installation.

It is not enough to symlink the local installation to /usr/bin/node.

Please uninstall nvm and any node versions installed with it:

rm -rf $NVM_DIR ~/.npm ~/.bower
unset NVM_DIR;
which node;
rm -rf {path_to_node_version}

Also look in your ~/.bash_profile or ~/.bashrc and remove any nvm lines.

@Aileen I thought nvm was only not recommended for production installs?

This is a local setup on a mac and that works just fine for me?

For some reason the local process manager isn’t working in this case. One way to debug that I know of is to try doing ghost run -D which runs without a process manager (you’ll have to keep the terminal window open). It should output any errors that Ghost is generating.

1 Like

Thank you so much~
I’ve tried the ghost run -D, I deleted my config.production.json file before, because I’d like to use ghost in development environment.
here’s the message:

~/Website/ghost ᐅ ghost run -D
The ghost run command is used by the configured Ghost process manager and for debugging. If you’re not running this to debug something, you should run ghost start instead.
/Users/xcnzhang/Website/ghost/versions/1.22.1/core/server/config/utils.js:77
throw new Error(‘Your content path does not exist! Please double check paths.contentPath in your custom config file e.g. config.production.json.’);
^

Error: Your content path does not exist! Please double check paths.contentPath in your custom config file e.g. config.production.json.
at doesContentPathExist (/Users/xcnzhang/Website/ghost/versions/1.22.1/core/server/config/utils.js:77:15)
at Object.loadNconf (/Users/xcnzhang/Website/ghost/versions/1.22.1/core/server/config/index.js:61:11)
at Object. (/Users/xcnzhang/Website/ghost/versions/1.22.1/core/server/config/index.js:78:27)
at Module._compile (module.js:570:32)
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. (/Users/xcnzhang/Website/ghost/versions/1.22.1/core/server/index.js:17:14)
at Module._compile (module.js:570:32)
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)

Yes… I totally missed that part with the Mac… :pensive:

There you go. You need a valid contentPath in your config.development.json. It should look like this:

{
  "url": "http://localhost:2368/",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "sqlite3",
    "connection": {
      "filename": "/Users/xcnzhang/Website/ghost/content/data/<db name>"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "local",
  "paths": {
    "contentPath": "/Users/xcnzhang/Website/ghost/content"
  }
}