简体   繁体   English

节点js mongoose mongoDB

[英]node js mongoose mongoDB

Using phpstorm, trying to get mongoDB server up and running using nodeJS, i have mongo installed and have created the required folders on the c drive to store database, proceeded by going to command prompt and entering mongod, to get mongo db running.... 使用phpstorm,尝试使用nodeJS启动mongoDB服务器并运行,我已经安装了mongo,并在c驱动器上创建了所需的文件夹来存储数据库,然后转到命令提示符并输入mongod,以使mongo db运行... 。

checked 已检查 在此处输入图片说明 npm ls,mongoose and mongo are listed fine, and are also present in my package json file. npm ls,mongoose和mongo列出的很好,并且也存在于我的包json文件中。

when i try to run the index file from commmand prompt 'node index.js' i get the following error, see pic for details, i have included, the code used for setting up mongo... i have disable mongoserver from phpstorm repository, and use the one from the mongodb website 当我尝试从命令提示符“ node index.js”运行索引文件时,出现以下错误,请参见图片以获取详细信息,我已包括用于设置mongo的代码...我已从phpstorm存储库中禁用mongoserver,并使用mongodb网站上的一个

"mongodb": "3.0.0-rc0", "mongoose": "^5.0.0-rc2", “ mongodb”:“ 3.0.0-rc0”,“ mongoose”:“ ^ 5.0.0-rc2”,

 var mongoose =require('mongoose'); //connect to mongoose mongoose.connect('mongodb://localhost/quaver'); mongoose.connection.once('open', function(){ console.log('connection has been made , and is running') }); mongoose.on('error', function(error){ console.log('Connection error',error); }); 

error sorted by omitting the following lines from the semver.js file, in the node modules folder in the current project 通过从当前项目的node modules文件夹中的semver.js文件中省略以下几行进行排序的错误

line 203,204 203,204行

//re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); // re [COMPARATORTRIM] =新的RegExp(src [COMPARATORTRIM],'g'); //nodevar comparatorTrimReplace = '$a$2$3'; // nodevar比较器TrimReplace ='$ a $ 2 $ 3';

and line 232 和232行

// re[i] = new RegExp(src[i]); // re [i] =新的RegExp(src [i]);

mongoose now up and running 猫鼬现在开始运行 在此处输入图片说明

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM