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) 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,558 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.