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 npm Basics (retiring) Installing Packages with npm Managing Dependencies in the package.json File

No dependencies in my package.json file.

When i created the package.json file, via

npm init

when i view my package file, I have all the information except the dependencies with the bcrypt version.

Anyone know why?

Whenever you run npm init it will create you a fresh copy of package.json and that includes having no dependencies or dev-dependencies. If you already had installed bcrypt and would like it in your package.json file just do as so:

npm i bcrypt --save

After that you can view your package.json file and you will see it has a section for dependencies.

3 Answers

Mike Constantino
Mike Constantino
12,034 Points

You always need to add the --save flag to save a package into your package.json. You can add this when your installing the package to your project.

fredyrosales
fredyrosales
10,572 Points

That didn't work for me uh.

Try deleting your node modules folder and npm install