I am tring to deploy a nodejs application, but I got the error Error: Cannot find module 'knex'
. In Heroku bash, there are no knex folder in node_modules. I installed knex through npm in Heroku bash, but no success. I changed my package.json like described in this question , but the error stills the same. Here is my package.json:
{
"name": "control",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start":"node index.js"
},
"license": "ISC",
"dependencies": {
"bcrypt-nodejs": "0.0.3",
"body-parser": "1.18.3",
"consign": "0.1.6",
"cors": "2.8.4",
"express": "4.16.3",
"jwt-simple": "^0.5.6",
"knex": "0.19.5",
"moment": "2.22.2",
"mysql": "^2.17.1",
"passport": "0.4.0",
"passport-jwt": "4.0.0",
"pg": "7.4.3",
"pm2": "3.0.4"
},
"devDependencies": {
"moment": "^2.20.1",
"nodemon": "1.18.4"
},
"engines" : {
"node" : "10.16.3",
"npm": "6.9.0"
}
}
I recommend you use yarn and the most current version of nodejs it is likely that you will have problems with the version of nodejs . here is the guide to update libraries.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.