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 trialCraig Curtis
19,985 PointsDifference between npm install something vs. npm install something --save vs. npm install something --save-dev
I've tried both --save and --save-dev npm installing, but in package.json, I only see something in dependencies rather than dev dependencies. So when do we use each of these?
- npm install something
- npm install something --save
- npm install something --save-dev
1 Answer
Chyno Deluxe
16,936 PointsHi Craig,
The differences between all three are as follow.
- will install the npm package to your node_modules folder and not be added to the package.json
- --save - package(s) required by the application to run
- --save-dev - package(s) required for development purpose.
Craig Curtis
19,985 PointsCraig Curtis
19,985 PointsOk it makes sense. I was just having an error that threw me off -- my index.html wasn't being updated with --save for some reason the first time. Thank you!
gerardo keys
14,292 Pointsgerardo keys
14,292 PointsI don't think this is correct any longer. The latest version of npm allows you to do npm install <package> and it does show up in package.json, without needing --save. You may need to update your comment.