首页 \ 问答 \ 在Ubuntu上安装了MongoDb,表示未安装(Installed MongoDb on Ubuntu, says its not installed)

在Ubuntu上安装了MongoDb,表示未安装(Installed MongoDb on Ubuntu, says its not installed)

在Ubuntu上按照网站上的分步说明安装MongoDb http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/当我尝试运行mongo时收到以下错误。 “程序'mongo'目前尚未安装。”

但它在目录中。

test@MongoDb1:~$ mkdir -p mongodb
test@MongoDb1:~$ ls

mongodb      mongodb-linux-x86_64-2.5.4.tgz

test@MongoDb1:~$ cp -R -n mongodb-linux-x86_64-2.5.4/ mongodb
test@MongoDb1:~$ cd mongodb
test@MongoDb1:~/mongodb$ ls

mongodb-linux-x86_64-2.5.4

test@MongoDb1:~/mongodb$ cd mongodb-linux-x86_64-2.5.4/
test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ ls

bin  GNU-AGPL-3.0  README  THIRD-PARTY-NOTICES

test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ cd bin/
test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ ls

bsondump  mongodump    mongoimport  mongorestore  mongotop
mongo     mongoexport  mongooplog   mongos
mongod    mongofiles   mongoperf    mongostat

test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ mongo

The program 'mongo' is currently not installed. You can install it by typing:
sudo apt-get install mongodb-clients

test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$

Installed MongoDb on Ubuntu following the step by step instructions on the site http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/ I receive the following error when I try and run mongo. "The program 'mongo' is currently not installed."

Yet it is in the directory.

test@MongoDb1:~$ mkdir -p mongodb
test@MongoDb1:~$ ls

mongodb      mongodb-linux-x86_64-2.5.4.tgz

test@MongoDb1:~$ cp -R -n mongodb-linux-x86_64-2.5.4/ mongodb
test@MongoDb1:~$ cd mongodb
test@MongoDb1:~/mongodb$ ls

mongodb-linux-x86_64-2.5.4

test@MongoDb1:~/mongodb$ cd mongodb-linux-x86_64-2.5.4/
test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ ls

bin  GNU-AGPL-3.0  README  THIRD-PARTY-NOTICES

test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ cd bin/
test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ ls

bsondump  mongodump    mongoimport  mongorestore  mongotop
mongo     mongoexport  mongooplog   mongos
mongod    mongofiles   mongoperf    mongostat

test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ mongo

The program 'mongo' is currently not installed. You can install it by typing:
sudo apt-get install mongodb-clients

test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$

原文:https://stackoverflow.com/questions/20503366
更新时间:2022-10-19 13:10

最满意答案

由于您无法单独推送产品,因此您需要构建包含所有产品的对象。

  • 第一步是检索已经在dataLayer中的对象(即使是空的)
  • 得到产品对象
  • 把新物品推进去
  • 将整个对象推送到dataLayer

如果您遇到任何此类问题,请告诉我。

尝试首先使用以下方法定义dataLayer varible:

var dataLayer = window.dataLayer || [];

它将采用现有的dataLayer变量并添加使用它,如果没有,它将为它创建数组。

另外,我可以看到你使用的是小写“datalayer”。 它应该是“dataLayer”。

我希望这将有所帮助。


I turns out google tag manager rewired dataLayer.push() method to fire events and guard the dataLayer's size. A side effect is that it does not operate as expected. The way to overcome this issue was to push all the scraped product data into a javascript variable and once it was ready, to push that variable into the dataLayer as follows:

function scrape2DL() {    
    dataLayer.push({'ecommerce.checkout.actionField': {step: 2}}); //action object

    var base = 0; 
    var products=[];
    while (base < $('div.field_cart').length/4) {
       products.push([{id: $('div.field_cart')[4 * base + 0].innerText, price: $('div.field_cart')[4 * base + 1].innerText.match(/[0-9]+/), quantity: $('div.field_cart')[4 * base + 2].innerText}]);
       base += 1;
    }//while 
    dataLayer.push({'ecommerce.checkout.products': products}); // add a product 
 }
 scrape2DL();
 dataLayer.push({event: 'checkout'});      // for GTM triggers

However it turns out that it is possible to fetch the products from the datalayer into a javascript variable using the datalayer get method and subsequently append more products into it. However I ultimately avoided this aproach as it skips the event and size guard check wired into dataLayer.push().

The folowing resources were of some help:

相关问答

更多
  • 您需要创建3个变量类型的自定义JavaScript函数,它从dataLayer中选择所需的值并将其返回到数组中。 就像是 function(){ var products = {{transactionProducts}}; var skuArray = []; for(i = 0; i < products.length; i++) { if(products[i].sku){ skuArray.push(products[i].sku) } } return skuAr ...
  • 我对非标准数据层所做的是创建一个带有javascript函数的自定义html标记,该函数将数据损坏为正确的形式。 然后,我将转换后的数据和自定义事件推送到数据层,并在自定义事件上触发了事务跟踪。 这样你可以使用UA标签和GTM,这将为你节省很多问题。 但是,可能已经帮助您的是转到属性设置并将支付提供商的域添加到referall排除列表。 似乎没有涉及实际的跨域跟踪(付款可能在另一个域上发生,但您确实没有代码)并且目前应该可以混合经典代码/ Universal Analytics,只要它们不在同一个页。 然而 ...
  • 在Google跟踪代码管理器中,您需要设置以下内容: 代码类型: Universal Analytics(Google Analytics)跟踪类型:屏幕视图 字段名称: screenName值:[我在下面标识的变量] 触发: “事件名称”上的触发包含屏幕 **注意触发器可能比匹配“screen_view”更好,但我没有机会测试 变量: Variable Type = Event Parameter Event Type = Custom Parameter Event Parameter Key = ...
  • 尝试两次后解决了这个问题。 首先,在搜索后,我发现这是一个Javascript异步问题。dataLayer在收到Rest call响应之前获取变量,因此该变量在dataLayer中不可用(在时间之前被检索到),并且可用于为了排序,dataLayer必须在成功接收响应后构建。因此,在成功接收响应之后调用了一个包含dataLayer的callback函数 AUI().ready('aui-base', function(A){ Liferay.Service( '/user/get-user-by ...
  • 您是否在要设置的字段中提供screenName? Universal Analytics代码需要screenName才能跟踪appView类型。 Are you supplying a screenName in fields to set? Universal Analytics tags require a screenName for tracking types appView.
  • 由于您无法单独推送产品,因此您需要构建包含所有产品的对象。 第一步是检索已经在dataLayer中的对象(即使是空的) 得到产品对象 把新物品推进去 将整个对象推送到dataLayer 如果您遇到任何此类问题,请告诉我。 尝试首先使用以下方法定义dataLayer varible: var dataLayer = window.dataLayer || []; 它将采用现有的dataLayer变量并添加使用它,如果没有,它将为它创建数组。 另外,我可以看到你使用的是小写“datalayer”。 它应该是“d ...
  • 回答Q1: GTM正在这样做,因为这是DataLayer按预期的行为: https : //github.com/google/data-layer-helper 回答Q2: 由Brian Kuhm本人(GTM背后的男人:)提供 ,如果你想阻止递归合并,你需要先发送一个空值,然后推送你的实际对象。 我创建了一个包装器来做到这一点: window.dataLayer = window.dataLayer || []; window.dataTrack = function(obj) { dataLayer ...
  • 转到变量部分,单击new,选择“datalayer variable”(datalayer版本默认为版本2,不要更改),输入要提取值的datalayer键(即eventLabel),然后给该变量命名 - 我通常使用dataLayer键作为名称,因此很明显变量包含什么。 然后在标签字段中输入新创建的变量(通过单击字段后面的符号并从列表中选择,或在{{double curly brackets}}中输入变量名称)。 Go to the variables section, click new, select " ...
  • 假设你正在使用上面的确切代码,那么你会遇到一些语法错误。 你不需要用引号来包装GTM变量 不要使用parseInt,因为它只返回一个整数。 请改用“数字”。 你遗漏了一个括号 所以你应该使用这样的东西: function(){ var total = 0; $({{product price}}).each(function(){ total += Number(this); }) return total; } I don't know if it is normal ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。