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

Add Open Global npm Config File as a JavaScript TIL

This commit is contained in:
jbranchaud
2024-02-28 12:40:48 -06:00
parent 24278989d8
commit 9a9cebaa11
2 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
# Open Global npm Config File
There are a ton of configuration settings for `npm`. I can open up the global
`npmrc` file where those configs live with the following command:
```bash
$ npm config edit --global
```
This will open up the file in my default editor (e.g. `vim`).
There are over 100 settings that are commented out with their default values. I
can override these as needed by uncommenting them and setting them to the
desired value.
There is some useful info in the first few lines:
```
;;;;
; npm globalconfig file: /Users/me/.asdf/installs/nodejs/20.10.0/etc/npmrc
; this is a simple ini-formatted file
; lines that start with semi-colons are comments
; run `npm help 7 config` for documentation of the various options
```
1. I can see that the location of the file is specific to the version of node
that I current have shimmed. In this case, it's `20.10.0`. If I switch node
versions, there will be a different `envrc` to configure.
2. I can get more info about these config values by running `npm help 7 config`.