源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

nodejs中安装ghost出错的原因及解决方法

  • 时间:2020-02-05 09:22 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:nodejs中安装ghost出错的原因及解决方法
看了标题就知道安装ghost会碰到不少的坑,这里先说一个: [b]错误[/b] (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时出错了呢? [b]原因[/b] 就是因为sqlite3的包(sqlite3 for node)在.s3.amazonaws.com上,这个被墙了。*(满眼的泪呀!) 知道了原因,要解决就很容易了。 [b]解决[/b] 解决方案是: 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来运行的话,还需要做一件事,将myghostblog\current\content\data\ghost-dev.db文件拷贝到myghostblog\content\data\ghost-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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部