diff options
author | NeonXP <i@neonxp.ru> | 2024-01-28 20:43:11 +0300 |
---|---|---|
committer | NeonXP <i@neonxp.ru> | 2024-01-28 22:07:35 +0300 |
commit | 11412b2e720f754900b39d195f33af39ed11d085 (patch) | |
tree | 96d7e561f21809aead3c0f25034f083f46ef064c /features/src/node/README.md | |
parent | 6c00916212073678bbeb3bdde3f121c4efad707a (diff) |
Diffstat (limited to 'features/src/node/README.md')
-rw-r--r-- | features/src/node/README.md | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/features/src/node/README.md b/features/src/node/README.md new file mode 100644 index 0000000..b983919 --- /dev/null +++ b/features/src/node/README.md @@ -0,0 +1,58 @@ + +# Node.js (via nvm), yarn and pnpm (node) + +Installs Node.js, nvm, yarn, pnpm, and needed dependencies. + +## Example Usage + +```json +"features": { + "ghcr.io/devcontainers/features/node:1": {} +} +``` + +## Options + +| Options Id | Description | Type | Default Value | +|-----|-----|-----|-----| +| version | Select or enter a Node.js version to install | string | lts | +| nodeGypDependencies | Install dependencies to compile native node modules (node-gyp)? | boolean | true | +| nvmInstallPath | The path where NVM will be installed. | string | /usr/local/share/nvm | +| nvmVersion | Version of NVM to install. | string | latest | + +## Customizations + +### VS Code Extensions + +- `dbaeumer.vscode-eslint` + +## Using nvm from postCreateCommand or another lifecycle command + +Certain operations like `postCreateCommand` run non-interactive, non-login shells. Unfortunately, `nvm` is really particular that it needs to be "sourced" before it is used, which can only happen automatically with interactive and/or login shells. Fortunately, this is easy to work around: + +Just can source the `nvm` startup script before using it: + +```json +"postCreateCommand": ". ${NVM_DIR}/nvm.sh && nvm install --lts" +``` + +Note that typically the default shell in these cases is `sh` not `bash`, so use `. ${NVM_DIR}/nvm.sh` instead of `source ${NVM_DIR}/nvm.sh`. + +Alternatively, you can start up an interactive shell which will in turn source `nvm`: + +```json +"postCreateCommand": "bash -i -c 'nvm install --lts'" +``` + + + +## OS Support + +This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed. + +`bash` is required to execute the `install.sh` script. + + +--- + +_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/node/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |