mongodb 在 Meteor 中运行示例的问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10103830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 12:36:20  来源:igfitidea点击:

Problems to run examples in Meteor

mongodbmeteor

提问by davidmatas

I'm testing Meteor examples and this is what I see when I run meteorin todos examples:

我正在测试 Meteor 示例,这就是我meteor在 todos 示例中运行时看到的:

Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod. Check for other processes listening on port 3002 or other meteors running in the same project.

And this is what happens if I run mongodin the command line:

如果我mongod在命令行中运行,就会发生这种情况:

Thu Apr 12 19:27:39 Mongo DB : starting : pid = 2686 port = 27017 dbpath = /data/db/ master = 0 slave = 0  32-bit 

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
**       see http://blog.mongodb.org/post/137788967/32-bit-limitations for more

Thu Apr 12 19:27:39 db version v1.4.4, pdfile version 4.5
Thu Apr 12 19:27:39 git version: nogitversion
Thu Apr 12 19:27:39 sys info: Linux murphy 2.6.32.14-dsa-ia32 #1 SMP Thu May 27 16:19:20 CEST 2010 i686 BOOST_LIB_VERSION=1_42
Thu Apr 12 19:27:39 waiting for connections on port 27017
Thu Apr 12 19:27:39 listen(): bind() failed errno:98 Address already in use for port: 27017
Thu Apr 12 19:27:39 MiniWebServer: bind() failed port:28017 errno:98 Address already in use
Thu Apr 12 19:27:39   addr already in use
Thu Apr 12 19:27:39 warning: web admin interface failed to initialize on port 28017

Someone helps? Thanks!

有人帮忙吗?谢谢!

回答by Kriss

I had the same problem. Fixed with:

我有同样的问题。固定:

WARNING: This erases your local database:

警告:这会删除您的本地数据库:

meteor reset

流星重置

回答by jsbeckr

I had the same problem. Just remove .meteor/local/db/mongod.lockin your meteor project folder. And meteor should run normally.

我有同样的问题。只需.meteor/local/db/mongod.lock在您的流星项目文件夹中删除即可。并且流星应该正常运行。

Hope it helped! :)

希望有帮助!:)

回答by Samo

As mKriss mentioned, try

正如 mKriss 提到的,尝试

meteor reset

If you get this error:

如果您收到此错误:

reset: Meteor is running.

This command does not work while Meteor is running your application.
Exit the running meteor development server.

Then look for meteor in your running processes:

然后在您正在运行的进程中寻找meteor:

ps -x | grep meteor

This gave me the following output:

这给了我以下输出:

14877 pts/0    Sl     0:02 /usr/lib/meteor/mongodb/bin/mongod --bind_ip 127.0.0.1 --port 3005 --dbpath /home/sam/proto/.meteor/local/db
15022 pts/0    S+     0:00 grep --color=auto meteor

So then I did:

然后我做了:

kill -s KILL 14877
meteor reset
meteor

Now everything works!

现在一切正常!

回答by devdave

Not sure if this is relevant to your problem, but I got this error and eventually discovered it was caused because I had my app directory in a NFS share (I am running on Ubuntu in VirtualBox) which mongodb doesn't like. Putting my app in my home directory instead fixed the problem.

不确定这是否与您的问题有关,但我收到此错误并最终发现这是因为我的应用程序目录位于 mongodb 不喜欢的 NFS 共享(我在 VirtualBox 中的 Ubuntu 上运行)中。将我的应用程序放在我的主目录中可以解决问题。

回答by Akshat

There are a few ways around this, the question didn't show how to use mongodso I'm going to run through how to get a bit more detail on the error. meteor resetmightwork but not always & it will clear your apps data if it does work.

有几种方法可以解决这个问题,问题没有显示如何使用,mongod所以我将介绍如何获得有关错误的更多详细信息。meteor reset可能有效,但并非总是如此,如果有效,它将清除您的应用程序数据。

The core issue is meteor is very undescriptive when it comes to displaying data, so I would advise to get get a bit more detail on the error as it could literally any mongodb error out there. The steps below should reproduce the error with more verbosity to help diagnose what the root issue is

核心问题是meteor 在显示数据时非常难以描述,因此我建议获得有关错误的更多详细信息,因为它实际上可能是任何mongodb 错误。下面的步骤应该更详细地重现错误,以帮助诊断根本问题是什么

Find where Meteor installs mongodb

查找 Meteor 安装 mongodb 的位置

If you have the mongodtool (downloadable from http://mongodb.com), otherwise use the one installed with meteor. Just be careful you don't get too new a version that upgrades your old database, then meteor's older mongodb won't be able to understand it.

如果你有这个mongod工具(可以从http://mongodb.com下载),否则使用安装了meteor 的那个。只是要小心,不要让升级旧数据库的版本太新,否则流星的旧 mongodb 将无法理解它。

typically (but not always) at

通常(但不总是)在

/usr/local/meteor/mongodb/bin/mongod (OS X)

/usr/lib/meteor/mongodb/bin/mongod (Red Hat/Debian)

C:\Program Files\Meteor\mongodb\bin\mongod.exe (Windows via Tom Wijsman's port)

/usr/local/meteor/mongodb/bin/mongod ( OS X)

/usr/lib/meteor/mongodb/bin/mongod ( Red Hat/Debian)

C:\Program Files\Meteor\mongodb\bin\mongod.exe(Windows 通过 Tom Wijsman 的端口

Run Meteor's database manually with mongodb

使用 mongodb 手动运行 Meteor 的数据库

So we're going to use this to manually run mongodb on your apps mongodb database:

因此,我们将使用它在您的应用程序 mongodb 数据库上手动运行 mongodb:

In your projects directory with your terminal app/command prompt

在带有终端应用程序/命令提示符的项目目录中

cd .meteor
cd local
/usr/local/meteor/mongodb/bin/mongod --dbpath ./

If your mongodpath is something else use that instead, the above works on OS X.

如果您的mongod路径是其他东西,请改用它,以上适用于 OS X。

Analyse the output to find the root cause of the issue

分析输出以找出问题的根本原因

Now mongodb should run and give you a good description of what the problem is, or run smoothly:

现在mongodb应该可以运行了,给你一个很好的描述问题所在,或者运行顺利:

Mon Apr  1 23:59:55 [initandlisten] MongoDB starting : pid=84640 port=27017 dbpath=./ 64-bit  host=MacBook-Pro.local
Mon Apr  1 23:59:55 [initandlisten] 
Mon Apr  1 23:59:55 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Mon Apr  1 23:59:55 [initandlisten] db version v2.2.1, pdfile version 4.5
Mon Apr  1 23:59:55 [initandlisten] git version: d6764bf8dfe0685521b8bc7b98fd1fab8cfeb5ae
Mon Apr  1 23:59:55 [initandlisten] waiting for connections on port 27017

Have a look at the what the error might be and then tackle the problem displayed. It could be one of many.

查看错误可能是什么,然后解决显示的问题。它可能是众多之一。

Example issue

示例问题

If it has:

如果有:

exception in initAndListen: 10310 Unable to lock file: ./mongod.lock. Is a mongod instance already running?, terminating

Then restart your computer to kill any processes that might be using the file and if it still doesn't help use meteor resetto clear the directory at .meteor/local/dbso your app uses a fresh database.

然后重新启动您的计算机以终止可能正在使用该文件的任何进程,如果它仍然无法meteor reset清除目录,则.meteor/local/db您的应用程序将使用新的数据库。

The errors are very helpful e.g low disk space (clear up the trash ;-)or cannot write to disk (permissions issue - use chmod/sudo).

这些错误非常有用,例如磁盘空间不足(清理垃圾;-)或无法写入磁盘(权限问题 - 使用 chmod/sudo)。

Very obscure issues

很晦涩的问题

If you find something very perplexing it might be a mongodb issue more than a meteor one, have a look around for the error you get here on stackoverflow and if you can't find it put a question up and swarms of helpful people are hopefully ready to help :)

如果您发现一些非常令人困惑的问题,它可能是一个 mongodb 问题而不是流星问题,请查看您在 stackoverflow 上遇到的错误,如果您找不到它,请提出问题,希望有一群乐于助人的人准备好帮助 :)

回答by ravshanoff

I have very simple solution:

我有非常简单的解决方案:

export LC_ALL="en_US.UTF-8"

export LC_ALL="en_US.UTF-8"

and run meteor

并运行 meteor

If it is ok, you can add this line to

如果没问题,您可以将此行添加到

sudo vim /usr/local/bin/meteor

sudo vim /usr/local/bin/meteor

回答by Dave

If meteor reset isn't working for you, check your disk space usage.

如果meteor reset 对您不起作用,请检查您的磁盘空间使用情况。

If you don't have any free disk space, you will get this error. MongoDB takes up about 450MBs, so creating a few projects can fill up a partition quickly.

如果您没有任何可用磁盘空间,则会出现此错误。MongoDB 占用大约 450MB,因此创建几个项目可以快速填满一个分区。

回答by Larry R.

If your meteor project is in a DropBox-folder, check for file names that contain the words conflicted copyin .meteor/local/db/in your project folder and remove them. That should free up Mongod to run.

如果您的流星项目是在DropBox的文件夹,检查包含单词的文件名conflicted copy.meteor/local/db/项目中的文件夹,删除它们。这应该释放 Mongod 运行。

回答by tomrozb

This is what helped me to run meteoron Google Compute Engine:

这是帮助我meteor在 Google Compute Engine 上运行的原因:

export LC_ALL=C

回答by Trinos

Watch for accents in the path of your projects.

注意项目路径中的口音。

..\Système\MyMeteorProject will not work, ..\System\MyMeteorProject will work.

..\Système\MyMeteorProject 将不起作用,..\System\MyMeteorProject 将起作用。