看了标题就知道安装ghost会碰到不少的坑,这里先说一个: 错误 (windows)通过ghost-cli来安装的步骤: npm install -g ghost-cli #全局安装ghost-cli
看了标题就知道安装ghost会碰到不少的坑,这里先说一个:
错误
(windows)通过ghost-cli来安装的步骤:
npm install -g ghost-cli #全局安装ghost-cli
cd myghostblog #进入工作目录
ghost install local #使用local参数在当前目录初始化一个ghost,使用sqlite数据库
出错信息如下:
√ Downloading and installing Ghost v?
√ Finishing install process
√ Configuring Ghost
√ Setting up instance
× Running database migrations
A SystemError occurred.
在ghost install local过程中不仅完成了ghost的初始化,还完成了依赖库的安装(也就是npm install)
从错误提示中看到Running database migrations出错了,其原因是:在下载依赖包sqlite3时出错,导致问题出现。
实际上在下载依赖包时出错,仅仅给出一个警告,警告都会跳过去,直到migrator这一步(数据迁移,也就是初始化数据库)出现了错误,导致安装失败。
而为什么下载sqlite3时出错了呢?
原因
就是因为sqlite3的包(sqlite3 for node)在.s3.amazonaws.com上,这个被墙了。*(满眼的泪呀!)
知道了原因,要解决就很容易了。
解决
解决方案是: cnpm install sqlite3 #使用taobao镜像安装
具体的过程如下:
npm install -g ghost-cli
cd myghostblog
ghost install local #会出错
cd current
cnpm install #补装依赖库,并使用taobao镜像安装
knex-migrator init #初始化sqlite数据库,会使用MigratorConfig.js
grunt dev #运行 Dev 环境
打开浏览器Http://localhost:2368/
加强
上面是在current目录下使用grunt运行起来的,如果要回到ghost-cli通过ghost来运行的话,还需要做一件事,将myghostbloGCurrentcontentdataghost-dev.db文件拷贝到myghostblogcontentdataghost-dev.db,并修改文件名为ghost-local.db。(注意看目录差别,中间有一个current目录的差别)
这样就可以回到myghostblog目录使用ghost start来启动了。
cd myghostblog
ghost start
打开浏览器http://localhost:2368/
最后再说一下环境
windows 10
Node Version: v6.10.3
Ghost-CLI Version: 1.1.3
Ghost Version: 1.14.0
2017-10-23
--结束END--
本文标题: nodejs中安装ghost出错的原因及解决方法
本文链接: https://www.lsjlt.com/news/12303.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0