| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent be01185 commit 2d84620
203 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ npm install <tarball url> | |||
| 22 | 22 | npm install <git:// url> | |
| 23 | 23 | npm install <github username>/<github project> | |
| 24 | 24 | ||
| 25 | - aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add | ||
| 25 | + aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall | ||
| 26 | 26 | ``` | |
| 27 | 27 | ||
| 28 | 28 | <!-- automatically generated, do not edit manually --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ description: Search for packages | |||
| 13 | 13 | ```bash | |
| 14 | 14 | npm search [search terms ...] | |
| 15 | 15 | ||
| 16 | - aliases: s, se, find | ||
| 16 | + aliases: find, s, se | ||
| 17 | 17 | ``` | |
| 18 | 18 | ||
| 19 | 19 | <!-- automatically generated, do not edit manually --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ description: Remove a package | |||
| 13 | 13 | ```bash | |
| 14 | 14 | npm uninstall [<@scope>/]<pkg>... | |
| 15 | 15 | ||
| 16 | - aliases: un, unlink, remove, rm, r | ||
| 16 | + aliases: unlink, remove, rm, r, un | ||
| 17 | 17 | ``` | |
| 18 | 18 | ||
| 19 | 19 | <!-- automatically generated, do not edit manually --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,6 +144,17 @@ This value is not exported to the environment for child processes. | |||
| 144 | 144 | <!-- automatically generated, do not edit manually --> | |
| 145 | 145 | <!-- see lib/utils/config/definitions.js --> | |
| 146 | 146 | ||
| 147 | + #### `workspaces-update` | ||
| 148 | + | ||
| 149 | + * Default: true | ||
| 150 | + * Type: Boolean | ||
| 151 | + | ||
| 152 | + If set to true, the npm cli will run an update after operations that may | ||
| 153 | + possibly change the workspaces installed to the `node_modules` folder. | ||
| 154 | + | ||
| 155 | + <!-- automatically generated, do not edit manually --> | ||
| 156 | + <!-- see lib/utils/config/definitions.js --> | ||
| 157 | + | ||
| 147 | 158 | #### `include-workspace-root` | |
| 148 | 159 | ||
| 149 | 160 | * Default: false | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ description: View registry info | |||
| 13 | 13 | ```bash | |
| 14 | 14 | npm view [<@scope>/]<pkg>[@<version>] [<field>[.subfield]...] | |
| 15 | 15 | ||
| 16 | - aliases: v, info, show | ||
| 16 | + aliases: info, show, v | ||
| 17 | 17 | ``` | |
| 18 | 18 | ||
| 19 | 19 | <!-- automatically generated, do not edit manually --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1027,13 +1027,26 @@ See also the `foreground-scripts` config. | |||
| 1027 | 1027 | <!-- automatically generated, do not edit manually --> | |
| 1028 | 1028 | <!-- see lib/utils/config/definitions.js --> | |
| 1029 | 1029 | ||
| 1030 | + #### `logs-dir` | ||
| 1031 | + | ||
| 1032 | + * Default: A directory named `_logs` inside the cache | ||
| 1033 | + * Type: null or Path | ||
| 1034 | + | ||
| 1035 | + The location of npm's log directory. See [`npm logging`](/using-npm/logging) | ||
| 1036 | + for more information. | ||
| 1037 | + | ||
| 1038 | + <!-- automatically generated, do not edit manually --> | ||
| 1039 | + <!-- see lib/utils/config/definitions.js --> | ||
| 1040 | + | ||
| 1030 | 1041 | #### `logs-max` | |
| 1031 | 1042 | ||
| 1032 | 1043 | * Default: 10 | |
| 1033 | 1044 | * Type: Number | |
| 1034 | 1045 | ||
| 1035 | 1046 | The maximum number of log files to store. | |
| 1036 | 1047 | ||
| 1048 | + If set to 0, no log files will be written for the current run. | ||
| 1049 | + | ||
| 1037 | 1050 | <!-- automatically generated, do not edit manually --> | |
| 1038 | 1051 | <!-- see lib/utils/config/definitions.js --> | |
| 1039 | 1052 | ||
@@ -1628,9 +1641,9 @@ particular, use care when overriding this setting for public packages. | |||
| 1628 | 1641 | * Default: false | |
| 1629 | 1642 | * Type: Boolean | |
| 1630 | 1643 | ||
| 1631 | - If true, writes an `npm-debug` log to `_logs` and timing information to | ||
| 1632 | - `_timing.json`, both in your cache, even if the command completes | ||
| 1633 | - successfully. `_timing.json` is a newline delimited list of JSON objects. | ||
| 1644 | + If true, writes a debug log to `logs-dir` and timing information to | ||
| 1645 | + `_timing.json` in the cache, even if the command completes successfully. | ||
| 1646 | + `_timing.json` is a newline delimited list of JSON objects. | ||
| 1634 | 1647 | ||
| 1635 | 1648 | You can quickly view it with this [json](https://npm.im/json) command line: | |
| 1636 | 1649 | `npm exec -- json -g < ~/.npm/_timing.json`. | |
@@ -1823,6 +1836,17 @@ This value is not exported to the environment for child processes. | |||
| 1823 | 1836 | <!-- automatically generated, do not edit manually --> | |
| 1824 | 1837 | <!-- see lib/utils/config/definitions.js --> | |
| 1825 | 1838 | ||
| 1839 | + #### `workspaces-update` | ||
| 1840 | + | ||
| 1841 | + * Default: true | ||
| 1842 | + * Type: Boolean | ||
| 1843 | + | ||
| 1844 | + If set to true, the npm cli will run an update after operations that may | ||
| 1845 | + possibly change the workspaces installed to the `node_modules` folder. | ||
| 1846 | + | ||
| 1847 | + <!-- automatically generated, do not edit manually --> | ||
| 1848 | + <!-- see lib/utils/config/definitions.js --> | ||
| 1849 | + | ||
| 1826 | 1850 | #### `yes` | |
| 1827 | 1851 | ||
| 1828 | 1852 | * Default: null | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,24 @@ | |||
| 1 | 1 | --- | |
| 2 | 2 | title: Logging | |
| 3 | 3 | section: 7 | |
| 4 | - description: Why, What & How we Log | ||
| 4 | + description: Why, What & How We Log | ||
| 5 | 5 | --- | |
| 6 | 6 | ||
| 7 | 7 | ### Description | |
| 8 | 8 | ||
| 9 | 9 | The `npm` CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations & environments. | |
| 10 | 10 | ||
| 11 | + ### Setting Log File Location | ||
| 12 | + | ||
| 13 | + All logs are written to a debug log, with the path to that file printed if the execution of a command fails. | ||
| 14 | + | ||
| 15 | + The default location of the logs directory is a directory named `_logs` inside the npm cache. This can be changed | ||
| 16 | + with the `logs-dir` config option. | ||
| 17 | + | ||
| 18 | + Log files will be removed from the `logs-dir` when the number of log files exceeds `logs-max`, with the oldest logs being deleted first. | ||
| 19 | + | ||
| 20 | + To turn off logs completely set `--logs-max=0`. | ||
| 21 | + | ||
| 11 | 22 | ### Setting Log Levels | |
| 12 | 23 | ||
| 13 | 24 | #### `loglevel` | |
@@ -28,8 +39,6 @@ The default value of `loglevel` is `"notice"` but there are several levels/types | |||
| 28 | 39 | ||
| 29 | 40 | All logs pertaining to a level proceeding the current setting will be shown. | |
| 30 | 41 | ||
| 31 | - All logs are written to a debug log, with the path to that file printed if the execution of a command fails. | ||
| 32 | - | ||
| 33 | 42 | ##### Aliases | |
| 34 | 43 | ||
| 35 | 44 | The log levels listed above have various corresponding aliases, including: | |
@@ -47,6 +56,15 @@ The log levels listed above have various corresponding aliases, including: | |||
| 47 | 56 | ||
| 48 | 57 | The `npm` CLI began hiding the output of lifecycle scripts for `npm install` as of `v7`. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in `package.json`. If you'd like to change this behavior & log this output you can set `foreground-scripts` to `true`. | |
| 49 | 58 | ||
| 59 | + ### Timing Information | ||
| 60 | + | ||
| 61 | + The `--timing` config can be set which does two things: | ||
| 62 | + | ||
| 63 | + 1. Always shows the full path to the debug log regardless of command exit status | ||
| 64 | + 1. Write timing information to a timing file in the cache or `logs-dir` | ||
| 65 | + | ||
| 66 | + This file is a newline delimited list of JSON objects that can be inspected to see timing data for each task in a `npm` CLI run. | ||
| 67 | + | ||
| 50 | 68 | ### Registry Response Headers | |
| 51 | 69 | ||
| 52 | 70 | #### `npm-notice` | |
@@ -55,6 +73,15 @@ The `npm` CLI reads from & logs any `npm-notice` headers that are returned from | |||
| 55 | 73 | ||
| 56 | 74 | This header is not cached, and will not be logged if the request is served from the cache. | |
| 57 | 75 | ||
| 76 | + ### Logs and Sensitive Information | ||
| 77 | + | ||
| 78 | + The `npm` CLI makes a best effort to redact the following from terminal output and log files: | ||
| 79 | + | ||
| 80 | + - Passwords inside basic auth URLs | ||
| 81 | + - npm tokens | ||
| 82 | + | ||
| 83 | + However, this behavior should not be relied on to keep all possible sensitive information redacted. If you are concerned about secrets in your log file or terminal output, you can use `--loglevel=silent` and `--logs-max=0` to ensure no logs are written to your terminal or filesystem. | ||
| 84 | + | ||
| 58 | 85 | ### See also | |
| 59 | 86 | ||
| 60 | 87 | * [config](/using-npm/config) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -339,7 +339,7 @@ file. | |||
| 339 | 339 | * Don't prefix your script commands with "sudo". If root permissions | |
| 340 | 340 | are required for some reason, then it'll fail with that error, and | |
| 341 | 341 | the user will sudo the npm command in question. | |
| 342 | - * Don't use `install`. Use a `.gyp` file for compilation, and `prepublish` | ||
| 342 | + * Don't use `install`. Use a `.gyp` file for compilation, and `prepare` | ||
| 343 | 343 | for anything else. You should almost never have to explicitly set a | |
| 344 | 344 | preinstall or install script. If you are doing this, please consider if | |
| 345 | 345 | there is another option. The only valid use of `install` or `preinstall` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,7 +160,7 @@ <h2 id="table-of-contents">Table of contents</h2> | |||
| 160 | 160 | npm install <git:// url> | |
| 161 | 161 | npm install <github username>/<github project> | |
| 162 | 162 | ||
| 163 | - aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add | ||
| 163 | + aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall | ||
| 164 | 164 | </code></pre> | |
| 165 | 165 | <!-- raw HTML omitted --> | |
| 166 | 166 | <!-- raw HTML omitted --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -166,7 +166,7 @@ <h3 id="description">Description</h3> | |||
| 166 | 166 | the results to only the paths to the packages named. Note that nested | |
| 167 | 167 | packages will <em>also</em> show the paths to the specified packages. For | |
| 168 | 168 | example, running <code>npm ls promzard</code> in npm's source tree will show:</p> | |
| 169 | - <pre lang="bash"><code>npm@8.5.5 /path/to/npm | ||
| 169 | + <pre lang="bash"><code>npm@8.6.0 /path/to/npm | ||
| 170 | 170 | └─┬ init-package-json@0.0.4 | |
| 171 | 171 | └── promzard@0.1.5 | |
| 172 | 172 | </code></pre> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments