Nodejs环境下ghost安装好后,无法使用注册功能,为啥?

Nodejs环境下ghost安装好后,无法使用注册功能,为啥?

问题说明

<img src=http://img.itc.cn/photo/oTBtOwz1BCG>

怎么注册不了:(

<img src=http://img.itc.cn/photo/oTBtGhtSQ1x> 怎么找不到jquery?这货没安装依赖?

咋办?

补充

下载zip包解压后,运行是没问题的,不知道从源码构建,为何会出错,问题好奇怪啊:(

6 回复

Nodejs环境下Ghost安装好后,无法使用注册功能,为啥?

问题说明

在Node.js环境下安装Ghost博客系统后,可能会遇到无法使用注册功能的情况。以下是一些可能的原因及解决方案。

截图:

问题描述:

  1. 无法注册:尝试注册时,页面显示错误或没有任何反应。
  2. 找不到jQuery:安装过程中可能出现依赖项未正确安装的问题。

解决方案

1. 检查Ghost配置

确保你的Ghost配置文件config.production.json中启用了用户注册功能。默认情况下,Ghost允许新用户注册。如果禁用了注册功能,可以按照以下步骤修改配置文件:

{
  "url": "https://your-ghost-blog.com",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "sqlite3",
    "connection": {
      "filename": "content/data/ghost-dev.db"
    }
  },
  "paths": {
    "contentPath": "content/"
  },
  "mail": {},
  "initApps": [
    {
      "name": "users",
      "settings": {
        "isRegistrationAllowed": true
      }
    }
  ]
}

确保"isRegistrationAllowed"设置为true

2. 安装缺失的依赖

如果你在安装过程中遇到了缺少依赖的问题,可以手动安装缺失的依赖项。例如,如果缺少jQuery,可以通过npm安装:

npm install --save jquery
3. 使用官方安装指南

确保你遵循了官方的安装指南进行安装。如果你是从源码构建Ghost,建议先清空已有的安装目录并重新安装。以下是基本的安装步骤:

# 克隆Ghost仓库
git clone https://github.com/TryGhost/Ghost.git
cd Ghost

# 安装依赖
npm install

# 构建项目
npm run build

# 启动Ghost
npm start

补充信息

如果你下载了zip包解压后运行没有问题,但源码构建有问题,可能是因为源码构建过程中的某些步骤出现了错误。建议检查构建日志以获取更多详细信息,并确保所有依赖项都已正确安装。

通过以上步骤,你应该能够解决Ghost无法使用注册功能的问题。如果问题仍然存在,请检查Ghost的日志文件以获取更多详细的错误信息。


搞个jquery进去不久行了。。。。

放到哪个目录呢?

为何要手动放呢? npm install 的时候,为何不直接把这些弄好呢:(

针对你的问题,Ghost 博客平台默认情况下是禁用了用户注册功能的。你需要手动启用它。

解释

Ghost 默认只允许管理员账户登录和管理网站。如果希望普通用户也能注册账户,需要进行一些配置更改。你需要编辑 Ghost 的配置文件 config.jsconfig.production.json 来允许用户注册。

示例代码

  1. 找到 Ghost 的配置文件,通常位于 Ghost 安装目录下的 content/config.jscontent/config.production.json 文件中。
  2. 修改配置文件,添加或修改以下字段:
module.exports = {
    // 其他配置项...
    mail: {
        transport: 'Direct'
    },
    database: {
        client: 'sqlite3',
        connection: {
            filename: path.join(__dirname, '/content/data/ghost-dev.db')
        }
    },
    server: {
        host: '127.0.0.1',
        port: '2369'
    },
    paths: {
        contentPath: path.join(__dirname, '/content/')
    },
    url: 'https://your-ghost-blog.com',
    init: {
        requireBlogOwner: false,
        emailVerification: false
    },
    authentication: {
        strategies: [
            'ghost-sso',
            'local'
        ],
        passwords: {
            local: {
                algorithm: 'bcrypt',
                saltRounds: 10
            }
        }
    },
    users: {
        registration: {
            confirmed: true,
            blocked: false
        }
    }
};

确保将 users.registration.confirmed 设置为 true 并且 blocked 设置为 false

总结

以上步骤应该能解决你遇到的问题。如果依然有问题,可能需要检查 Ghost 版本或查看日志文件以获取更多信息。希望这可以帮助到你!

回到顶部