I tried upgrading my Ghost install from 4.36.1 to 4.41.3, but it fails to run.
With ghost running, the page just stays on the “We’ll be right back” message but in the /ghost/content/logs directory, there’s this in the production error log:
{"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}
I was using Nodejs 14.18.3 before and it worked fine, I haven’t upgraded the node version. I also had 16.13.2 on the system that I use for another app so tried using that too but I get the same error.
The upgrade seemed to go smooth enough (I have to do it manually as I can’t run ghost-cli), ran the knex-migrator migration after checking health which completed successfully but it seems there’s some issue with knex running npm install mysql2 --save when that already exists (I actually use MariaDB 10.3.34), though I’ve been manually upgrading Ghost for over two years and never had this sort of issue before.
Edit: I did attempt to revert back to 4.36.1 using a full backup but that wouldn’t work however I’ve tried reinstalling it the way I’d normally do an install/upgrade manually, using node 14.18.3 and a backup of the database prior to using knex-migrator and I now have my site back up and running again, so I can only assume this issue is something to do with newer ghost versions and the slightly older node versions?