简体   繁体   中英

Upgrading (mongodb) npm package major version in node.js project

I am new in Node.js ,, I will start working in a project that was implemented years ago .. using Node.js , mongodb and angular 4 .

i checked the file package.json for the mongdb and i had found this value "mongodb": "^2.1.21"

I want to upgrade the application to use the latest version of mongodb , so i had run this command npm i mongodb@latest

but it gave me an error that the upgrade to the latest version which is 3.3.0-beta2 is invalid

so i changed the command into npm i mongodb@2.2.36 . Now i don't how to make it accept to update to the latest stable version of mongodb . and what are the changes that i need to do to my code to make sure it runs successfully .

also regarding the mongo db server , do i need to install the latest version to make my application run successfully after upgrading the mongodb node package ..? i did many investigations and couldn't reach to clear answer regarding this

For your question, run

npm i --save mongodb@latest

to install and update the dependency in package.json .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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