Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript npm Basics (retiring) Updating and Uninstalling Packages with npm Updating Packages with npm

James Barrett
James Barrett
13,253 Points

Updating an individual package

Hi guys,

I notice that Andrew uses the npm outdated command to check which packages are outdated. When npm update is ran, is this going to update all packages in the package.json file? If so, how would we update one individual package? Would it merely be a case of adding the package name after the npm update command? For example:

npm update [packageNameHere]

Thanks, James.

1 Answer

andren
andren
28,503 Points

When npm update is ran, is this going to update all packages in the package.json file?

Yes, it will update all dependencies listed in the package.json file.

Would it merely be a case of adding the package name after the npm update command?

Yes, the example command you provide is entirely valid, if you specify a name then npm will only update that specific package.