Remote shared server mysql2 error

I recently changed to Orange Host based on the positive reviews and got it up and running due to @Hyperbytes’s video OrangeHost, sub $2 per month Node hosting for Wappler - full setup tutorial

When I upgraded to 6.5.0, I published the site and I am now getting the following error:

message
: 
"Knex: run\n$ npm install mysql2 --save\nopen EEXIST"
stack
: 
"Error: Knex: run\n$ npm install mysql2 --save\nopen EEXIST\n    at Client_MySQL2.initializeDriver (/home/usofapag/nodevenv/nodejsapp/20/lib/node_modules/knex/lib/dialects/mysql2/index.js:33:13)\n    at new Client (/home/usofapag/nodevenv/nodejsapp/20/lib/node_modules/knex/lib/client.js:83:12)\n    at new Client_MySQL2 (/home/usofapag/nodevenv/nodejsapp/20/lib/node_modules/knex/lib/dialects/mysql2/index.js:9:1)\n    at knex (/home/usofapag/nodevenv/nodejsapp/20/lib/node_modules/knex/lib/knex-builder/Knex.js:16:28)\n    at App.setDbConnection (/home/usofapag/nodejsapp/lib/core/app.js:407:27)\n    at App.getDbConnection (/home/usofapag/nodejsapp/lib/core/app.js:426:25)\n    at App.paged (/home/usofapag/nodejsapp/lib/modules/dbconnector.js:406:25)\n    at App._exec (/home/usofapag/nodejsapp/lib/core/app.js:611:57)\n    at App._exec (/home/usofapag/nodejsapp/lib/core/app.js:578:28)\n    at async App.exec (/home/usofapag/nodejsapp/lib/core/app.js:547:9)"
status
: 
"500"

Any advice or suggestions on how to resolve this? I did try re-running NPM Install and it ran successfully without errors.

Try manually installing mysql2 manually as outlined in this post.

I will add a video to the series outlining how to resolve this issue.

I did try that solution and followed your tip at the end of the video to make sure it was the right path.

I even deleted the nodejs app completely and started over, but still getting the same error.

Not at computer at moment but will check this out when I get a chance.

1 Like

You need to navigate to your project folder using the command cd, and only then execute the relevant npm command

You can use command ls to list all files in the current directory

we are now using indeed the new driver for mysql called mysql2

check if it is in your package.json and it is uploaded. After that run indeed npm install on your live server to update it. Or on your control panel if you are using one

Already done.

It looks like everything is there in the CPanel.

Screenshot 2024-04-20 at 12.02.17 PM

@George will have to verify this but it looks like if you edit your database connection in the Database Manager and in Globals you will see MySQL/MariaDB (Depreciated), so you need to click the list and select use MySQL/MariaDB and click Save. This will then install the new Node packages for you…

Yes it is actually fully your own choice which MySQL driver you use. We don’t change anything.

Only for the automatic docker generated db connections we default to the new mysql2

1 Like

I thought about that and changed that.

Yes that uses the new mysql2 driver.

So now your server needs it only.

Not sure how NodeJS works on cPanel but shouldn’t the node modules be under your app folder?

George is right

I don’t have the same interpretation

What folder is your project in? The folder in your screenshot is not your project folder

You probably need to run it inside folder nodejsapp

I followed the video in the initial post and it was working just fine before the 6.5.0 upgrade.

There was a link folder created in the app folder that points to the modules folder.

Screenshot 2024-04-20 at 12.16.24 PM

Did you restart the app?

1 Like

With OrangeHost, they created the nodevenv folder and and the entries within along with the link folder node_modules in the app root folder when the nodejs app is created within CPanel.

Oh yes, I restarted it multiple times, giggles.

I stopped the app, clicked on NPM install, got the green confirmation message saying installed with no errors, then started the app.

I deleted the nodejs app in CPanel, which removed all the entries in the nodevenv folder. I deleted the nodevenv folder and the created linked node_modules folder. Then deleted the nodejsapp folder. Then created the app from scratch as well.

I also ran npm install using the CPanel built in Terminal.

This is what shows when I do the npm version.


Any other ideas on how to best resolve this?