简体   繁体   English

当我尝试在Couchbase Node.js服务器上运行简单测试时,出现“参数错误”错误

[英]I get “Incorrect argument” error when i try to run a simple test on couchbase nodejs server

var couchbase = require("couchbase");



var cluster = new couchbase.Cluster('127.0.0.1:8091');
var bucket = cluster.openBucket('beer-sample', function(err) {
    if (err) {

        throw err;
    }



    bucket.get('aass_brewery-juleol', function(err, result) {
        if (err) {

            throw err;
        }

        var doc = result.value;

        console.log(doc.name + ', ABV: ' + doc.abv);

        doc.comment = "Random beer from Norway";

        bucket.replace('aass_brewery-juleol', doc, function(err, result) {
            if (err) {

                throw err;
            }

            console.log(result);


            process.exit(0);
        });
    });
});

Here is my file. 这是我的档案。 It's the example from here : http://docs.couchbase.com/developer/node-2.0/hello-couchbase.html 这是这里的示例: http : //docs.couchbase.com/developer/node-2.0/hello-couchbase.html

So when i try to run the server with "nodejs test1.js" i get "Incorrect argument" error. 因此,当我尝试使用“ nodejs test1.js”运行服务器时,出现“错误参数”错误。

At bucket.js, module.js and in cluster.js into node_modules/couchbase/lib/ 在bucket.js,module.js和cluster.js中进入node_modules / couchbase / lib /

I have installed couchbase and i have full nodejs installed. 我已经安装了ouchbase,并且已经安装了完整的nodejs。 I'm new in this and i cant understand where is my mistake. 我是新来的,我不明白我的错误在哪里。 Maybe something with the versions of the couchbase or the node version i dunno. 也许有些东西与沙发床的版本或我不知道的节点版本有关。

Here is my full error which i get into the terminal: 这是我进入终端机的完整错误:

Error: Incorrect argument
at New Bucket (home/anton/node_modules/couchbase/lib/bucket.js:213:16)
at Object<anonymus> (home/anton/PhpstormProjects/couchbase/test1.js:6:22)
at Cluster.openBucket (home/anton/node_modules/couchbase/lib/cluster.js:37:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

The "Canonical" format for connecting to a cluster is couchbase://host where host in your case is localhost . 用于连接到集群的“规范”格式为couchbase://host ,其中您的主机localhost

Depending on the version you're using, newer enhancements may have been added to allow for the common host:8091 antipattern, but would still be incorrect. 根据您使用的版本,可能已添加了较新的增强功能,以允许使用通用host:8091反模式,但仍然不正确。

Chances are your code can still work if you upgrade to a newer version - but you should still use the couchbase:// variant (without the port). 如果升级到较新的版本,您的代码可能仍然可以工作-但您仍应使用couchbase://变体(不带端口)。

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

相关问题 开玩笑时出现错误,我尝试运行测试 - Error on jest when I try to run the test 当我尝试测试运行我的 MySQL 数据库时收到此错误消息 - I get this error message when I try to test run my MySQL database 当尝试在IE中将Rule添加到样式表时出现无效参数错误 - I get Invalid argument error when try to addRule to stylesheet in ie 如何使这个简单的Try / Catch测试工作? - How do I get this simple Try/Catch test to work? 为什么当我尝试运行服务器 gRPC 时出现此错误? - why i'm i getting this error when i try to run my server gRPC? 为什么当我尝试运行这个简单的 React 组件时会抛出错误? - Why does this simple React component throw an error when I try to run it? 当我尝试运行mocha测试时,工作人员没有定义 - Worker not defined when I try to run mocha test 当我尝试比较 Mongoose 中的日期时,我收到 ZCCADCDEDB567ABAE643E15DCF0974E503Z 服务器错误,为什么? - When I try comparing dates in Mongoose, I get Mongoose Server Error, why? 当我尝试使用cropperJS获得50%的图像时出现错误 - I get the error when i try get 50% of the image with cropperJS 当我尝试测试本地Meteor程序包时出错 - Error when I try to test a local Meteor package
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM