Developer docs

Using nvm with local and production installs

This guide explains how to use nvm with local and production Ghost installs.

Production install

If nvm is installed locally in /root or /home then you’ll run into permission problems. Ghost requires a system wide installation. We recommend uninstalling nvm to avoid permission problems. A symlink from the local installation to usr/bin/node will not work.

Uninstall nvm using:

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

Open ~/.bash_profile or ~/.bashrc and remove any nvm lines.

Local installation

If you run into problems during a local install, it could be due to your installation of nvm (Node Version Manager).

Ensure nvm is installed correctly:

  • Ensure that nvm is not installed in the root folder /root/.nvm. If nvm is installed in the root folder, uninstall nvm, and reinstall it using a non-root user.
  • Set your nvm default version to the one you will use for Ghost before installing ghost-cli. If your default is different, you should switch to the correct version each time you start a new session and run any ghost commands.
  • Ensure ghost-cli is installed in the correct environment. On a machine with nvm configured correctly, you should see:
which ghost -> /Users/[username]/.nvm/versions/node/[node version]/bin/ghost
npm root -g -> /Users/[username]/.nvm/versions/node/[node version]/lib/node_modules

If these paths aren’t in the same [node version], it means you’ve installed ghost-cli in a different environment than the active node environment. ghost-cli needs to be installed and run in the same environment.

To resolve this choose one of the following:

Run npm install ghost-cli -g in the current environment to get the right sqlite3 node module into the environment and go through ghost setup process again.

If you remember which nvm node environment you’ve installed ghost-cli under, run nvm use <node version>.