java-script:npm:global-local-packages
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| java-script:npm:global-local-packages [2023/08/09 17:04] – odefta | java-script:npm:global-local-packages [2025/01/02 18:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 35: | Line 35: | ||
| **Versioning**: | **Versioning**: | ||
| + | ===== Comparison ===== | ||
| + | - **Flexibility**: | ||
| + | - **Ease of use**: **Global** installation is easier to use across multiple projects but might lead to version conflicts. | ||
| + | - **Isolation**: | ||
| + | ===== Example ===== | ||
| + | Suppose you want to use terser to minify files: | ||
| + | ==== Global Installation ==== | ||
| + | |||
| + | Install: | ||
| + | < | ||
| + | npm install -g terser | ||
| + | </ | ||
| + | and then run: | ||
| + | < | ||
| + | terser file.js -o file.min.js | ||
| + | </ | ||
| + | |||
| + | ==== Local Installation ==== | ||
| + | |||
| + | Install: | ||
| + | < | ||
| + | npm install terser | ||
| + | </ | ||
| + | and then run within the project where terser is installed: | ||
| + | < | ||
| + | npx terser file.js -o file.min.js | ||
| + | </ | ||
java-script/npm/global-local-packages.1691600643.txt.gz · Last modified: (external edit)
