mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-19 20:13:44 +00:00
docs: add docker tips
This commit is contained in:
parent
4436638816
commit
07ed13a7bb
19
README.md
19
README.md
@ -9,6 +9,7 @@
|
|||||||
- [Installing and Updating](#installing-and-updating)
|
- [Installing and Updating](#installing-and-updating)
|
||||||
- [Install & Update Script](#install--update-script)
|
- [Install & Update Script](#install--update-script)
|
||||||
- [Additional Notes](#additional-notes)
|
- [Additional Notes](#additional-notes)
|
||||||
|
- [Installing in Docker](#installing-in-docker)
|
||||||
- [Troubleshooting on Linux](#troubleshooting-on-linux)
|
- [Troubleshooting on Linux](#troubleshooting-on-linux)
|
||||||
- [Troubleshooting on macOS](#troubleshooting-on-macos)
|
- [Troubleshooting on macOS](#troubleshooting-on-macos)
|
||||||
- [Ansible](#ansible)
|
- [Ansible](#ansible)
|
||||||
@ -84,6 +85,24 @@ Eg: `curl ... | NVM_DIR="path/to/nvm"`. Ensure that the `NVM_DIR` does not conta
|
|||||||
|
|
||||||
- The installer can use `git`, `curl`, or `wget` to download `nvm`, whichever is available.
|
- The installer can use `git`, `curl`, or `wget` to download `nvm`, whichever is available.
|
||||||
|
|
||||||
|
#### Installing in Docker
|
||||||
|
|
||||||
|
To install `nvm` in Docker, you may need to prepare you image's environment
|
||||||
|
in advanced in order to use `node` & `npm`. Here's a winning recipe:
|
||||||
|
|
||||||
|
```Dockerfile
|
||||||
|
# set your target node version
|
||||||
|
ENV NODE_VERSION 14.13.1
|
||||||
|
# set NVM_DIR
|
||||||
|
ENV NVM_DIR="$HOME/.nvm"
|
||||||
|
# patch PATH
|
||||||
|
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
||||||
|
# install!
|
||||||
|
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash \
|
||||||
|
&& source $NVM_DIR/nvm.sh \
|
||||||
|
&& nvm install ${NODE_VERSION}
|
||||||
|
```
|
||||||
|
|
||||||
#### Troubleshooting on Linux
|
#### Troubleshooting on Linux
|
||||||
|
|
||||||
On Linux, after running the install script, if you get `nvm: command not found` or see no feedback from your terminal after you type `command -v nvm`, simply close your current terminal, open a new terminal, and try verifying again.
|
On Linux, after running the install script, if you get `nvm: command not found` or see no feedback from your terminal after you type `command -v nvm`, simply close your current terminal, open a new terminal, and try verifying again.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user