Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build a REST API With Express Building API Routes in Express Building the Answer Routes

I'm using npm version 5.6.0. Everytime I install morgan, npm removes the body-parser.

I'm using npm version 5.6.0. Everytime I install morgan, npm removes the body-parser. When I install the body-parser again, npm removes the morgan packages. I went back and forth for a while and then used the --save flag on one and not the other and that worked, but later in the course when I installed Mongoose, then Morgan was uninstalled again by the npm. I then re-installed morgan and then Mongoose was uninstalled by the npm. I have looked around and found that there was a bug in npm v. 5 and up so far that is causing it to delete packages when installing new packages occasionally. No one has really found a work around this. I guess my main question is... what is a stable version of npm that I can use that will allow me to complete this course?

1 Answer

Well I think I figured out the issue. I read that there was a bug in npm that was causing this issue. I didn't realize version 6.0.1 was the current stable version. (I'm very new to all this). Anyways, to fix the problem I updated to the new npm version, but realized that even the current version was still behaving the same way. I took a peek into my package js file and realized there were no dependencies listed, even though for this project we need body parser, morgan, and mongoose. So... I looked at an old project and seen how the dependency section looked. Basically just manually added the dependencies and then tried to re-install all the packages I needed and ...BINGO! That did the trick. Just in case anyone else ever runs into this issue.