Node.js: Can't get a simple single query to display on remote (Knex?)

Just tried same npm install on my orangehost account via phone, I get same error message,
Npm: command not found

Offtopic
@brad is there any specific reason why you are not using VPS with Docker instead?
It much more easier to manage and extremely unified in usage in term - your PROD docker image will be always the same as DEV docker image.

Orangehost is a new host supporting node very cheaply.
Docker is a choice, it suits some people, not some others.
I, personally, always use a VPS and FTP as I have has issues with docker in the past.

Provider: Hetzner
Location: Helsinki

What can be cheaper?

Cost and the lack of interest in learning docker. With orange I can host a lot of small sites on one single account for $2 a month and not have to worry about all the problems people on this community are having with docker.

These are just small personal projects. If it was client work and each one needed its own host I might explore that. But I donā€™t do client projects.

1 Like

The cost is not that affordable when you start adding more projects. It works out too about $8 a month Canadian per project.

Orange is $2 month and I can host everything. And servers are in North America.

1 Like

OK, think i have found the issue, NPM is not in the system PATH

you can run NPM by specifying the full path in the command

nodevenv/nodejsapp/10/bin/npm install mysql --save

NOTE. I have managed to run command on mobile phone BUT not tested past install

if this does not work, try changing ā€œnodejsappā€ in the path to match the node applciation folder as i note these match in my case and not sure if it is by design or coincidence.

PS i also note it shows node V10, not sure what issues this may cause and if wappler will force upgrade (needs 16+ ?)

Thinking about it, nodevenv/my_node_folder/10/bin/npm is probably the way to go.

Either way you can check by using file manager to drill down on the ā€œnodevenvā€ folder

2 Likes

Thanks Brian, that seems to install

[lawrykca@server216 ~]$ nodevenv/sandbox.lawryk.ca/10/bin/npm install mysql --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ mysql@2.18.1
updated 1 package and audited 255 packages in 2.483s

26 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

[lawrykca@server216 ~]$

But unfortunately it doesnā€™t fix the error and the data is still not displayed. Any help here, @George?

@Hyperbytes! You are an absolute god! I have it working!

Just had to change the 10 in your command to 18 to match the node version I was using.

nodevenv/sandbox.lawryk.ca/18/bin/npm install mysql --save

Look for some more coffee coming your way soon! Much appreciated, Brian.

1 Like

if you are using MySQL in your Wappler projects and have a server connect database connection to it, then the package.json should always have a reference to mysql or mysql2

then when running ā€œnpm installā€ in cPanel everything should be installed nicely.

Maybe you didnā€™t have any database connections initially but added them later on?

Then you will just need to republish so that the new package.json gets uploaded and run the same ā€œnpm installā€ in cPanel again.

2 Likes

I did add the MySQL connection after as I couldnā€™t get SQLite to work. But it never did get added to the package file.