I installed node.js on my shared hosting with Cpanel (See screenshot)
Then knex installed without any problem.
{
"name": "cmonapp",
"version": "1.0.0",
"description": "APPLICATION NAME",
"main": "start.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Meric",
"license": "ISC",
"dependencies": {
"hapi-auth-jwt": "^4.0.0",
"jsonwebtoken": "^8.2.2",
"knex": "^0.14.6",
"mysql": "^2.15.0"
}
}
But when I try to run knex init command by the SSH I get an error like " -bash: knex: command not found "
Can someone help me to fix this issue?
knex
binary will be installed in the node_modules/.bin
folder.
If you are using [email protected]
and above, use npx
to access your local dependencies like:
➜ npx knex --version
Knex CLI version: 0.15.0
Local Knex version: 0.15.0
If npx
is not available,
➜ $(npm bin)/knex --version
Knex CLI version: 0.15.0
Local Knex version: 0.15.0
Needless to say knex init
command would work in both the options
➜ npx knex init
Created ./knexfile.js
either install knex globally
npm install -g knex
or
use npx knex
this will read to your node_modules directory and run the bin/knex executable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With