1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add Ensure Shell Can Find Global npm Binaries as a javascript til

This commit is contained in:
jbranchaud
2020-12-20 00:41:50 -06:00
parent 9177c8488c
commit 05deaf1f46
2 changed files with 32 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
_977 TILs and counting..._
_978 TILs and counting..._
---
@@ -333,6 +333,7 @@ _977 TILs and counting..._
- [Destructure With Access To Nested Value And Parent Value](javascript/destructure-with-access-to-nested-value-and-parent-value.md);
- [Destructuring The Rest Of An Array](javascript/destructuring-the-rest-of-an-array.md)
- [Enable ES7 Transforms With react-rails](javascript/enable-es7-transforms-with-react-rails.md)
- [Ensure Shell Can Find Global npm Binaries](javascript/ensure-shell-can-find-global-npm-binaries.md)
- [Easy Date Comparison With DayJS](javascript/easy-date-comparison-with-dayjs.md)
- [Expand Emojis With The Spread Operator](javascript/expand-emojis-with-the-spread-operator.md)
- [Fill An Input With A Ton Of Text](javascript/fill-an-input-with-a-ton-of-text.md)

View File

@@ -0,0 +1,30 @@
# Ensure Shell Can Find Global npm Binaries
When you install a package globablly either with yarn (or npm)
```bash
$ yarn global add vercel
```
It places the binaries for that package in the `bin` directory of your package
manager's configured path prefix.
The absolute path to this `bin` directory can be found with:
```bash
$ yarn global bin
/Users/jbranchaud/.asdf/installs/nodejs/15.4.0/.npm/bin
```
You can ensure that everything located in that `bin` directory is on your
shell's path by adding the following line to your shell's config file (e.g.
`.bashrc` or `.zshrc`).
```bash
export PATH="$PATH:$(yarn global bin)"
```
Once you've updated your shell config, make sure you _source_ the file or
restart your shell.
[source](https://stackoverflow.com/a/40333409/535590)