Ghost
Ghost copied to clipboard
Ghost cannot run under LiteSpeed Node on cPanel
Issue Summary
Although not recommended since probably 2018, I still have the need to install Ghost under cPanel. I've tracked down the issue to knex not being able to locate mysql2.
Here is the commit that broke the installation.
Here is a forum post by someone else mentioning the issue.
From the stack-trace, I noticed that knex requires the database packages conditionally, and has them as peer dependencies (as it should be, since it's compatible with them all).
What is weird is that the migrations work, and as far as I know Ghost uses knex-migrator.
I know this may not be an inherent issue with Ghost, especially since it's not a recommended way of deploying the application. I'm just hoping that someone with more experience in cPanel & LiteSpeed specifically may be able to pinpoint the issue exactly.
Also, the cPanel instance I use has MySQL 5.7. Since the migrations run, and knex-migrator uses mysql2 as well, I thought this shouldn't be a problem.
Steps to Reproduce
- Authenticate into a cPanel instance that supports NodeJS. Create a NodeJS application.
- Install ghost-cli globally.
- Use this to make a local install of Ghost.
- Change the config files (config.development.json, config.production.json) accordingly, to connect to a MySQL database.
- (If you have MySQL 5.7) change the row format to dynamic. You have to do this manually, multiple times, until the migration is complete. Example:
ALTER TABLE members_product_events ROW_FORMAT=DYNAMIC;
. - Try to start ghost by running the node app from cPanel.
Ghost Version
5.8.2
Node.js Version
16.15.0
How did you install Ghost?
Using the CLI, on a node virtual environment, on cPanel. It uses LiteSpeed Node.
Database type
MySQL 5.7
Browser & OS version
No response
Relevant log / error output
{"name":"Log","hostname":"domainremoved","pid":2352271,"level":50,"err":{"id":"8fec50b0-aa99-11ec-8044-e7767faa5190","domain":"http://localhost:2368","code":null,"name":"InternalServerError","statusCode":500,"level":"critical","message":"Knex: run\n$ npm install mysql2 --save\nEEXIST: file already exists, uv_pipe_open","stack":"Error: Knex: run\n$ npm install mysql2 --save\n$ npm install mysql2 --save\nEEXIST: file already exists, uv_pipe_open\n at Client_MySQL2.initializeDriver (/node/16/lib/node_modules/knex/lib/client.js:235:13)\n at Client_MySQL2.Client (/node/16/lib/node_modules/knex/lib/client.js:69:10)\n at Client_MySQL2.Client_MySQL (/node/16/lib/node_modules/knex/lib/dialects/mysql/index.js:20:10)\n at new Client_MySQL2 (/node/16/lib/node_modules/knex/lib/dialects/mysql2/index.js:11:16)\n at Knex (/node/16/lib/node_modules/knex/lib/knex.js:14:28)\n at Object.connect (/node/16/lib/node_modules/knex-migrator/lib/database.js:35:12)\n at KnexMigrator.isDatabaseOK (/node/16/lib/node_modules/knex-migrator/lib/index.js:566:32)\n at DatabaseStateManager.getState (/public_html//ghost/core/server/data/db/state-manager.js:40:37)\n at DatabaseStateManager.makeReady (/public_html//ghost/core/server/data/db/state-manager.js:73:36)\n at initDatabase (/public_html/ghost/core/boot.js:60:26)\n at bootGhost (/public_html/ghost/core/boot.js:394:15)","hideStack":false},"msg":"Knex: run\n$ npm install mysql2 --save\nEEXIST: file already exists, uv_pipe_open","time":"2022-03-23T11:08:26.302Z","v":0}
Code of Conduct
- [X] I agree to be friendly and polite to people in this repository
Hey @ugudango 👋
We've reviewed your bug report and believe the issue is environment specific, rather than a bug. Many questions can be answered by reviewing our documentation. If you can't find an answer then our forum is a great place to get community support, plus it helps create a central location for searching problems/solutions.