node.js 如何检查猫鼬(MongoDb)是否安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24277602/
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
how to check if mongoose (MongoDb) is installed or not
提问by Amit
I installed mongoose using
我安装了猫鼬使用
sudo npm install -g mongoose
Please advice on how I can check to see if its installed properly. I am using Mac
请建议我如何检查它是否安装正确。我正在使用 Mac
回答by JRodDynamite
To check if mongoosemodule is installed simply find the version by
要检查mongoose模块是否安装,只需通过以下方式查找版本
npm list mongoose
To check globally
全局检查
npm list -g mongoose
回答by s2t2
Mongoose is a npm module. Mongodb may or may not be installed.
Mongoose 是一个 npm 模块。Mongodb 可能已安装,也可能未安装。
To check whether mongodb is installed:
要检查是否安装了 mongodb:
which mongo
To install mongodb locally:
在本地安装 mongodb:
brew install mongodb
Then follow the post-installation instructions.
然后按照安装后的说明进行操作。
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Test your connection to mongodb.
测试您与 mongodb 的连接。
mongo
回答by Rana Pratap Singh
Two ways to check whether mongoose is install in your ubuntu/debian.
检查 mongoose 是否安装在您的 ubuntu/debian 中的两种方法。
a) check locally( means into your project directory within node_modules)
a) 在本地检查(意味着在node_modules 中进入您的项目目录)
For local - npm list mongoose
对于本地 - npm list mongoose
b) check globally( means in your OS within node_modules ).
b) 全局检查(意味着在您的操作系统中的 node_modules 中)。
For global check- npm list -g mongoose
对于全局检查- npm list -g mongoose
It will show you the version of mongoose, if it already installed. If not then this will show this-
如果已经安装,它会向您显示 mongoose 的版本。如果没有,那么这将显示这一点-
/home//.nvm/versions/node/v6.11.0/lib └── (empty) npm ERR! code 1
/home//.nvm/versions/node/v6.11.0/lib └── (空) npm ERR!代码 1
To install mongoose in ubuntu/debian, run this command in terminal - npm install --save mongoose
要在 ubuntu/debian 中安装 mongoose,请在终端中运行此命令 - npm install --save mongoose
回答by Anthony Poblacion
If you are using MongoLab, to connect to database type: mongo
If you are running Mongo locally, start the Mongo daemon:
In the terminal type: mongod
If that doesnt run try: sudo mongod
Once mongoDB is running open another terminal window and type: mongo
In the same window type: show dbs
To work with a database in the list named myDB, for example type : use myDB
如果您使用 MongoLab,连接到数据库类型:mongo
如果您在本地运行 Mongo,请启动 Mongo 守护进程:
在终端类型:mongod
如果没有运行尝试:sudo mongod
一旦 mongoDB 运行打开另一个终端窗口并键入: mongo
在同一个窗口中键入:show dbs
要使用名为 myDB 的列表中的数据库,例如键入:使用 myDB
回答by tBlack
use npm list mongoose if mongoose is not installed you will get this respose `-- (empty)
如果未安装 mongoose,请使用 npm list mongoose 您将获得此响应 `--(空)

