本文介绍了Heroku上的Couchbase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个普遍的问题,但是我有一个用node编写的简单的"gym log"应用程序,并且我正在使用Couchbase作为数据库.在计算机上运行时,一切正常.当我将其部署到Heroku并尝试运行它时,就会出现问题.当我检查日志时,出现错误,提示找不到module couchbase.

This might be a general question, but I have a simple "gym log" app, written in node and I am using Couchbase as the database. Everything works when I run it on my machine. The problem arises when after I've deployed it to Heroku and try to run it. When I check the logs I get the error that module couchbase could not be found.

我是否必须在heroku中添加附件或将couchbase定义为我的package.json中的依赖项,我的应用才能在heroku上运行?

Do I have to add an add-on to heroku or define couchbase as a dependency in my package.json for my app to work on heroku?

有人可以给我一些指示吗?

Could someone give me some pointers please?

这是我所有代码的链接: github/MMRibot/loGym

Here is the link to all my code:github/MMRibot/loGym

推荐答案

错误找不到模块Couchbase"意味着您的Node应用无法找到Couchbase模块.您最有可能使用"npm install couchbase"在本地安装了它,因此它可以在您的计算机上使用.要使其在Heroku上正常运行,您必须将couchbase模块依赖项添加到package.json文件中.

The error "module couchbase could not be found" means your Node app can't find the couchbase module. You most likely installed it locally with "npm install couchbase", so it works on your machine. To have it working on Heroku, you have to add the couchbase module dependency to your package.json file.

  "dependencies": {
    "hapi": "^6.0.2",
    "joi": "^4.6.1",
    "request": "^2.37.0",
    "underscore": "^1.6.0",
    "couchbase": "*"
  }

如果您不想使用最新版本(在撰写本文时为2.0.3),请用特定的版本替换"*".

Replace "*" with a specific version if you don't want to use the latest (2.0.3 as of this writing.)

这篇关于Heroku上的Couchbase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:33