简体   繁体   English

Heroku 错误:无法使用 nodejs 部署找到模块“knex”

[英]Heroku Error: Cannot find module 'knex' with nodejs deploy

I am tring to deploy a nodejs application, but I got the error Error: Cannot find module 'knex' .我正在尝试部署 nodejs 应用程序,但出现错误Error: Cannot find module 'knex' In Heroku bash, there are no knex folder in node_modules. Heroku bash,node_modules里面没有knex文件夹。 I installed knex through npm in Heroku bash, but no success.我通过Heroku bash中的npm安装了knex,但是没有成功。 I changed my package.json like described in this question , but the error stills the same.我按照这个问题中的描述更改了我的 package.json,但错误仍然存在。 Here is my package.json:这是我的 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 .我建议您使用 yarn 和最新版本的nodejs ,您可能会遇到nodejs版本的问题。 here is the guide to update libraries.这是更新库的指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM