---
title: "node.js - How to fix npm throwing error without sudo - Stack O..."
description: "!https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo#answer-41395398"
date: 2024-04-09
published: true
tags:
  - dev
  - thought
  - webdev
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo#answer-41395398" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-content">
      <div class="embed-card-title">External Link</div>
      <div class="embed-card-meta">stackoverflow.com</div>
    </div>
  </a>
</div>


Its sad that this is not the accepted answer.


``` bash
mkdir ~/.npm-global
export NPM_CONFIG_PREFIX=~/.npm-global
export PATH=$PATH:~/.npm-global/bin
```
