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.
Jefferson Lessa5,684 Points
How do I update a npm package to its lastest version?
I'm aware that you can use the '^' symbol to allow a package to accept minor updates, and a '~' symbol to accept patch updates. What do I do if I want to accept major updates?
And is there a way of doing these things without changing my package.json file?
Roy Penrod19,807 Points
That's because of the instructions in the package.json file.
If you're sure you want to upgrade to the newest version and you know it won't break your app, you can open the package.json file in a text editor.
Find the line under either "dependencies" or "devDependencies" that mentions the package you want to update. Look for the version info to the right of the colon. It probably looks something like:
"boo" : "2.0.1"
Add a "greater than or equal to" sign in front of the version # like this:
"boo" : ">=2.0.1"
The "greater than or equal to" sign in front of the version tells it to grab the newest version that's greater than or equal to 2.01.
There are other options you can use. Check out the npm documentation and look for the section on dependencies.