{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/blog/how-to-use-install-npm-packages-without-sudo-on-linux-and-macos/",
    "result": {"data":{"markdownRemark":{"html":"<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 590px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/35608adce54b55ba93476dc88bd7af14/8e1fc/linux-article.jpg\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 100%; position: relative; bottom: 0; left: 0; background-image: url('data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAUABQDASIAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAAAAIDBP/EABYBAQEBAAAAAAAAAAAAAAAAAAIBBP/aAAwDAQACEAMQAAABylis/QzIVJSEv//EABsQAAIBBQAAAAAAAAAAAAAAAAECEBESEyBB/9oACAEBAAEFAuQUZhge4imn/8QAGBEBAQADAAAAAAAAAAAAAAAAAQACEBL/2gAIAQMBAT8BMC5I1//EABcRAQADAAAAAAAAAAAAAAAAABEAARD/2gAIAQIBAT8BbY7/AP/EABgQAAMBAQAAAAAAAAAAAAAAAAABIRAg/9oACAEBAAY/AtgnC8f/xAAcEAEBAAICAwAAAAAAAAAAAAABEQAhEDFhcZH/2gAIAQEAAT8hkqncl3gihTfkxIyj6cMafc7LA2XFU0cTn//aAAwDAQACAAMAAAAQ+P8APv/EABgRAAIDAAAAAAAAAAAAAAAAAAERABAx/9oACAEDAQE/EDw4Xbb/xAAXEQADAQAAAAAAAAAAAAAAAAAAAREQ/9oACAECAQE/EGqCh5//xAAgEAEBAAIBAwUAAAAAAAAAAAABEQAxIRBRcWGBkbHR/9oACAEBAAE/EHm/RD3TtkSagL+2UeCZQR8YyiREWLv43l2Qaq6fGVwQ1b9YCcmQ7HT/2Q=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"how to install npm packages without sudo mac linux\"\n        title=\"install npm packages without sudo\"\n        src=\"/static/35608adce54b55ba93476dc88bd7af14/1c72d/linux-article.jpg\"\n        srcset=\"/static/35608adce54b55ba93476dc88bd7af14/a80bd/linux-article.jpg 148w,\n/static/35608adce54b55ba93476dc88bd7af14/1c91a/linux-article.jpg 295w,\n/static/35608adce54b55ba93476dc88bd7af14/1c72d/linux-article.jpg 590w,\n/static/35608adce54b55ba93476dc88bd7af14/a8a14/linux-article.jpg 885w,\n/static/35608adce54b55ba93476dc88bd7af14/8e1fc/linux-article.jpg 900w\"\n        sizes=\"(max-width: 590px) 100vw, 590px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<h2>How to Use Install npm packages without sudo on Linux and MacOS</h2>\n<p>Permissions issues are frustrating. Sometimes you don’t WANT to give things administrator-level access to your computer. Or maybe you’re on someone else’s system, and you CAN’T give it administrator-level access; you don’t have that level of access either. Maybe you just don’t want to have to type ‘sudo’ first every time. All are legitimate frustrations developers have to deal with at some point.</p>\n<p>And as any of those developers will tell you, the only thing more irritating than giving something admin access is dealing with systems with mixed permissions: some packages can be installed with only user permissions, and seemingly work just fine. That is, until you need that package for something different.</p>\n<p>Soon you find yourself in the hell of installing, uninstalling, reinstalling, sorting through trying to figure out which packages are installed where, and cleaning up issues left behind from installing and reinstalling.</p>\n<h3>Here’s how to configure npm on your Linux or MacOS system to be permission frustration-free:</h3>\n<p>First, open a terminal and create a hiddeHere’s how to configure npm on your Linux or MacOS system to be permission frustration-free:n folder in your Home directory. This will be npm’s new default directory for global installations, we’ll call it npm-global.</p>\n<p><code> cd ; mkdir .npm-global </code></p>\n<p>Next, tell npm to use the new directory path as default.</p>\n<p><code> npm config set prefix '~/.npm-global' </code></p>\n<p>Using your favorite text editor, open or create a ~/.profile file and add this line to it</p>\n<p><code> export PATH=~/.npm-global/bin:$PATH </code></p>\n<p>Save and close the .profile file. Returning to your terminal, enter:</p>\n<p><code> source ~/.profile </code></p>\n<p>And you’re done! To test it out, trying running this to install JSHint, an open-source static analysis tool that can catch some common errors and save you tons of debugging time</p>\n<p><code> npm install -g jshint </code></p>","frontmatter":{"title":"How to Use Install npm packages without sudo on Linux and MacOS","description":"This quick tutorial will show you how to Install npm packages without sudo on Linux and MacOS.","seotitle":"How to Use Install npm packages without sudo on Linux and MacOS","seodescription":"This quick tutorial will show you how to Install npm packages without sudo on Linux and MacOS.","featuredimage":{"childImageSharp":{"gatsbyImageData":{"layout":"constrained","backgroundColor":"#188898","images":{"fallback":{"src":"/static/57ea28696b878931091b76a77ffa08c9/d588e/linux.jpg","srcSet":"/static/57ea28696b878931091b76a77ffa08c9/9542a/linux.jpg 105w,\n/static/57ea28696b878931091b76a77ffa08c9/5c446/linux.jpg 209w,\n/static/57ea28696b878931091b76a77ffa08c9/d588e/linux.jpg 418w","sizes":"(min-width: 418px) 418px, 100vw"},"sources":[{"srcSet":"/static/57ea28696b878931091b76a77ffa08c9/20fdf/linux.webp 105w,\n/static/57ea28696b878931091b76a77ffa08c9/48086/linux.webp 209w,\n/static/57ea28696b878931091b76a77ffa08c9/68e5a/linux.webp 418w","type":"image/webp","sizes":"(min-width: 418px) 418px, 100vw"}]},"width":800,"height":800}}}}}},"pageContext":{"slug":"/how-to-use-install-npm-packages-without-sudo-on-linux-and-macos/","previous":{"fields":{"slug":"/google-cloud-300-free-credit/"},"frontmatter":{"title":"Google Cloud $300 Free Credit","subtitle":"Learn Google Cloud with 12 months and $300 in Credit","featuredpost":true}},"next":{"fields":{"slug":"/wordpress-the-command-line-and-you/"},"frontmatter":{"title":"Wordpress, the Command Line, and You","subtitle":"WordPress can be intimidating on the Command line. ","featuredpost":true}}}},
    "staticQueryHashes": []}