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 User Authentication With Express and Mongo User Registration Setting Up Mongoose and a Mongo Database

How can I install the mongoose package?

I've been following the instructions from the tutor since the S1V4 folder so there was no need to navigate to S2V3 folder but still I get this error in my terminal whenever I attempt to install mongoose. I'm using Windows Powershell in my Atom text editor on windows 8.1 Pro by the way.

The error I get in my terminal:

PS C:\Users\Osaro\Desktop\S1V4> npm install mongoose --save

npm ERR! Unexpected end of JSON input while parsing near '...9d597c853ad9591d92b00'

npm ERR! A complete log of this file can be found in:

npm ERR! C:\Users\Osaro\AppData\Roaming\npm-cache_logs\2017-11-07T17_13_36_363Z-debug.log

Keep in mind that I've install node, npm and MongoDB on my PC.

2 Answers

Hello,

Check if your npm is uptodate - npm-windows-upgrade --npm-version latest - and run one more time - npm install mongoose -

My npm is up to date. There was a solution to the problem on Stack Overflow. All I had to do was type 'npm clear cache' in my Atom terminal. Oh yeah I also had to add the 'force' flag. So I typed ' npm clear cache --force' in my terminal and then installed the mongoose successfully.

Ok, I had that kind of error, sometimes it's easy to solve, sometimes more tricky. Great you found by yourself.