{"id":612,"date":"2016-11-29T11:35:18","date_gmt":"2016-11-29T11:35:18","guid":{"rendered":"https:\/\/www.audero.it\/blog\/?p=612"},"modified":"2018-04-08T15:34:08","modified_gmt":"2018-04-08T15:34:08","slug":"most-used-npm-commands","status":"publish","type":"post","link":"https:\/\/www.audero.it\/blog\/2016\/11\/29\/most-used-npm-commands\/","title":{"rendered":"My most used npm commands"},"content":{"rendered":"<p>If you&#8217;re a front-end or a JavaScript developer, you&#8217;re surely using npm. <a href=\"https:\/\/www.npmjs.com\" target=\"_blank\">npm<\/a> is a registry where people publish their software. At the beginning, developers used npm to share JavaScript libraries and frameworks, but today you can also find CSS frameworks, font icons, and much more. In addition to being a registry, npm has also its own client that allows you to manage the dependency of a project. Through the npm client, you can install, update, delete packages published on the npm registry and not only.<\/p>\n<p>In this article, I&#8217;ll discuss some of the less known npm commands that I use the most.<br \/>\n<!--more--><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"789\" data-permalink=\"https:\/\/www.audero.it\/blog\/2016\/11\/29\/most-used-npm-commands\/npm\/\" data-orig-file=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg\" data-orig-size=\"970,526\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg\" src=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg\" alt=\"npm\" width=\"970\" height=\"526\" class=\"aligncenter size-full wp-image-789\" srcset=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg 970w, https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm-300x163.jpg 300w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/p>\n<h2>List globally installed packages<\/h2>\n<p>Often I find myself wondering what npm packages I have globally installed on a machine. The command to find the name of the globally installed packages and their version is the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nnpm list -g --depth=0\r\n<\/pre>\n<h2>Remove unused packages from the node_modules folder<\/h2>\n<p>When working on a new project, you may try different packages before choosing the one that works best for you. So, you might end up having your node_modules folder filled with packages (and their dependencies) that you aren&#8217;t using anymore. To clean up the node_modules folder and claim some space back, you can use the command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nnpm prune\r\n<\/pre>\n<h2>Find outdated packages<\/h2>\n<p>Any project that is under development for more than a week will eventually use a version of one or more packages that isn&#8217;t up to date. To check if there are newer versions of the packages declared in your package.json file, you can run the command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nnpm outdated\r\n<\/pre>\n<p>The result will be something like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"623\" data-permalink=\"https:\/\/www.audero.it\/blog\/2016\/11\/29\/most-used-npm-commands\/npm-outdated-example\/\" data-orig-file=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm-outdated-example.jpg\" data-orig-size=\"600,151\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"npm outdated example\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm-outdated-example.jpg\" src=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm-outdated-example.jpg\" alt=\"npm outdated example\" width=\"600\" height=\"151\" class=\"aligncenter size-full wp-image-623\" srcset=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm-outdated-example.jpg 600w, https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm-outdated-example-300x76.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h2>Conclusions<\/h2>\n<p>The npm client is the first and most used client available for the npm registry. In addition to the usual <code>install<\/code>, <code>search<\/code>, and <code>test<\/code>, the npm client offers many other interesting commands. In this article, I&#8217;ve introduced you to some of the less known npm commands that I find very useful, that is <code>list<\/code>, <code>prune<\/code>, and <code>outdated<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re a front-end or a JavaScript developer, you&#8217;re surely using npm. <a href=\"https:\/\/www.npmjs.com\" target=\"_blank\">npm<\/a> is a registry where people publish their software. At the beginning, it was used to share JavaScript libraries and frameworks, but today you can also find CSS frameworks, font icons, and much more. In addition to being a registry, npm has also its own client that allows to manage the dependency of a project. Through the npm client, you can install, update, delete packages published on the npm registry and not only.<\/p>\n<p>In this article, I&#8217;ll discuss the less known npm commands I use the most.<\/p>\n","protected":false},"author":1,"featured_media":614,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[46,68],"class_list":["post-612","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-javascript","tag-npm"],"jetpack_featured_media_url":"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm-logo.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9Or4e-9S","jetpack-related-posts":[{"id":329,"url":"https:\/\/www.audero.it\/blog\/2014\/09\/19\/resources-beginner-front-end-developers\/","url_meta":{"origin":612,"position":0},"title":"Resources for Beginner Front-end Developers","author":"Aurelio De Rosa","date":"September 19, 2014","format":false,"excerpt":"Few weeks ago I received an email from a developer asking me for suggestions on how to delve into the front-end world. After having replied to this email, I thought that it'd have been nice to share the same suggestions on my blog. That's exactly what you'll find in this\u2026","rel":"","context":"In &quot;Discussions &amp; Opinions&quot;","block_context":{"text":"Discussions &amp; Opinions","link":"https:\/\/www.audero.it\/blog\/category\/discussions-opinions\/"},"img":{"alt_text":"html5 css3 javascript logos","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":387,"url":"https:\/\/www.audero.it\/blog\/2015\/05\/29\/trick-of-the-day-immutability-in-javascript\/","url_meta":{"origin":612,"position":1},"title":"Trick of the day: Immutability in JavaScript","author":"Aurelio De Rosa","date":"May 29, 2015","format":false,"excerpt":"In computer science there is a concept called Immutability. If you create an immutable object, once it's created you aren't allowed to change it anymore. This includes adding, modifying, or deleting a properties. For very simple situations, this concept isn't used a lot. However, if you start writing complex applications\u2026","rel":"","context":"In &quot;Trick of the day&quot;","block_context":{"text":"Trick of the day","link":"https:\/\/www.audero.it\/blog\/category\/trick-of-the-day\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":360,"url":"https:\/\/www.audero.it\/blog\/2015\/05\/27\/job-offers-errors-and-how-to-avoid-them\/","url_meta":{"origin":612,"position":2},"title":"Job Offers Errors and How to Avoid Them","author":"Aurelio De Rosa","date":"May 27, 2015","format":false,"excerpt":"As we all know, IT is a growing field and it's easy to find a job (at least compared to other fields). We're overwhelmed by job offers and recruiters emails sent to find the right person for their clients. Unfortunately, many of these offers are written by people without any\u2026","rel":"","context":"In &quot;Discussions &amp; Opinions&quot;","block_context":{"text":"Discussions &amp; Opinions","link":"https:\/\/www.audero.it\/blog\/category\/discussions-opinions\/"},"img":{"alt_text":"job offer","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2015\/05\/job-offer.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2015\/05\/job-offer.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2015\/05\/job-offer.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2015\/05\/job-offer.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2015\/05\/job-offer.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":375,"url":"https:\/\/www.audero.it\/blog\/2015\/06\/05\/trick-of-the-day-memoization-in-javascript\/","url_meta":{"origin":612,"position":3},"title":"Trick of the day: Memoization in JavaScript","author":"Aurelio De Rosa","date":"June 5, 2015","format":false,"excerpt":"Functions in JavaScript are really different from many other languages as they are first-class citizens. What this means is that they are treated like any other data type, including objects (actually they are objects), and as such functions can possess properties and even functions, can be assigned to variables, and\u2026","rel":"","context":"In &quot;Trick of the day&quot;","block_context":{"text":"Trick of the day","link":"https:\/\/www.audero.it\/blog\/category\/trick-of-the-day\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":832,"url":"https:\/\/www.audero.it\/blog\/2018\/07\/20\/5-javascript-interview-questions-a-mid-level-developer-should-be-able-to-answer\/","url_meta":{"origin":612,"position":4},"title":"5 JavaScript interview questions a mid-level developer should be able to answer","author":"Aurelio De Rosa","date":"July 20, 2018","format":false,"excerpt":"According to the results of the 2018's StackOverflow survey, JavaScript is the most popular technology. The amount of job offers for JavaScript developers is constantly increasing and with more companies adopting JavaScript as their main language, it's easy to find good ones. But before you are hired by a company,\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/www.audero.it\/blog\/category\/javascript\/"},"img":{"alt_text":"job interview panel","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":626,"url":"https:\/\/www.audero.it\/blog\/2016\/12\/05\/monkey-patching-javascript\/","url_meta":{"origin":612,"position":5},"title":"Monkey patching in JavaScript","author":"Aurelio De Rosa","date":"December 5, 2016","format":false,"excerpt":"When working on a project, we often use libraries that implement methods that aren't built-in in the programming language in use but we need. These libraries don't cover all the possible methods, so they might lack one or more crucial features we need. When this happens, we have two choices:\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/www.audero.it\/blog\/category\/javascript\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/monkey-patching.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts\/612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/comments?post=612"}],"version-history":[{"count":10,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts\/612\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts\/612\/revisions\/790"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/media\/614"}],"wp:attachment":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/media?parent=612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/categories?post=612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/tags?post=612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}