Home >Web Front-end >JS Tutorial >Solution to error when installing ghost in nodejs

Solution to error when installing ghost in nodejs

小云云
小云云Original
2018-01-04 09:35:171255browse

This article mainly introduces the causes and solutions of ghost installation errors in nodejs. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.

After reading the title, you know that installing ghost will encounter a lot of pitfalls. Here is one:

Error

(windows) through ghost -cli installation steps:


npm install -g ghost-cli  #全局安装ghost-cli
cd myghostblog   #进入工作目录
ghost install local #使用local参数在当前目录初始化一个ghost,使用sqlite数据库

The error message is as follows:


√ Downloading and installing Ghost v?
√ Finishing install process
√ Configuring Ghost
√ Setting up instance
× Running database migrations
A SystemError occurred.

In the process of ghost install local not only Completed the initialization of ghost, and also completed the installation of dependent libraries (that is, npm install)

From the error message, we can see that there is an error in Running database migrations. The reason is: when downloading the dependent package sqlite3 Something went wrong, causing problems.

Actually, an error occurs when downloading dependency packages. If only a warning is given, the warning will be skipped until an error occurs in the migrator step (data migration, that is, initializing the database), causing the installation to fail.

Why did an error occur when downloading sqlite3?

The reason

is because the sqlite3 package (sqlite3 for node) is on .s3.amazonaws.com, which is blocked. *(My eyes are full of tears!)

Once you know the reason, it will be easy to solve it.

Solution

The solution is: cnpm install sqlite3 #Use taobao mirror installation

The specific process is as follows:


npm install -g ghost-cli
cd myghostblog     
ghost install local   #会出错
cd current
cnpm install      #补装依赖库,并使用taobao镜像安装
knex-migrator init   #初始化sqlite数据库,会使用MigratorConfig.js
grunt dev      #运行 Dev 环境

Open the browser http://localhost:2368/

Enhancement

The above is run using grunt in the current directory. If you want to go back If you want to run ghost-cli through ghost, you need to do one more thing. Copy the myghostblog\current\content\data\ghost-dev.db file to myghostblog\content\data\ghost-dev.db and modify the file name. for ghost-local.db. (Pay attention to the directory difference. There is a difference in the current directory in the middle)

In this way, you can return to the myghostblog directory and use ghost start to start it.


cd myghostblog
ghost start

Open the browser http://localhost:2368/

Finally let’s talk about the environment


windows 10
  Node Version: v6.10.3
  Ghost-CLI Version: 1.1.3
  Ghost Version: 1.14.0
2017-10-23

Related recommendations:

In-depth analysis of the Hosts file failure problem of ghost win8 system

Migrate Ghost from SQLite3 database to MySQL database_MySQL

ghostwu Simple and easy to understand javascript variable promotion

The above is the detailed content of Solution to error when installing ghost in nodejs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn