Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: nodejs in web container should be link to /usr/local/bin/node #5774

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content/users/extend/customization-extendibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ There are many ways to deploy Node.js in any project, so DDEV tries to let you s
* [`ddev npm`](../usage/commands.md#npm) and [`ddev yarn`](../usage/commands.md#yarn) provide shortcuts to the `npm` and `yarn` commands inside the container, and their caches are persistent.
* You can run Node.js daemons using [`web_extra_daemons`](#running-extra-daemons-in-the-web-container).
* You can expose Node.js ports via `ddev-router` by using [`web_extra_exposed_ports`](#exposing-extra-ports-via-ddev-router).
* You can manually run Node.js scripts using [`ddev exec <script>`](../usage/commands.md#exec) or `ddev exec nodejs <script>`.
* You can manually run Node.js scripts using [`ddev exec <script>`](../usage/commands.md#exec) or `ddev exec node <script>`.

!!!tip "Please share your techniques!"
There are several ways to share your favorite Node.js tips and techniques. Best are [ddev-get add-ons](additional-services.md#additional-service-configurations-and-add-ons-for-ddev), [Stack Overflow](https://stackoverflow.com/tags/ddev), and [ddev-contrib](https://github.com/ddev/ddev-contrib).
Expand Down
2 changes: 1 addition & 1 deletion docs/content/users/usage/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Type `ddev` or `ddev -h` in a terminal window to see the available DDEV [command

## Node.js, npm, nvm, and Yarn

`nodejs`, `npm`, `nvm` and `yarn` are preinstalled in the web container. You can configure the default value of the installed Node.js version with the [`nodejs_version`](../configuration/config.md#nodejs_version) option in `.ddev/config.yaml` or with `ddev config --nodejs_version`. You can also override that with any value using the built-in `nvm` in the web container or with [`ddev nvm`](../usage/commands.md#nvm), for example `ddev nvm install 6`. There is also a [`ddev yarn`](../usage/commands.md#yarn) command.
`node`, `nodejs`, `npm`, `nvm` and `yarn` are preinstalled in the web container. You can configure the default value of the installed Node.js version with the [`nodejs_version`](../configuration/config.md#nodejs_version) option in `.ddev/config.yaml` or with `ddev config --nodejs_version`. You can also override that with any value using the built-in `nvm` in the web container or with [`ddev nvm`](../usage/commands.md#nvm), for example `ddev nvm install 6`. There is also a [`ddev yarn`](../usage/commands.md#yarn) command. (Note that since `nodejs_version` configuration can now specify any `node` version, including patch versions, it's preferred to using the less robust `ddev nvm` way of specifying the `node` version.)

## More Bundled Tools

Expand Down
2 changes: 1 addition & 1 deletion docs/content/users/usage/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ ddev npm update

## `nvm`

Run [`nvm`](https://github.com/nvm-sh/nvm#usage) inside the web container (global shell web container command).
Run [`nvm`](https://github.com/nvm-sh/nvm#usage) inside the web container (global shell web container command). (Use of `ddev nvm` is discouraged because `nodejs_version` is much easier to use, can specify any version, and is more robust than using `nvm`.)

Example:

Expand Down
2 changes: 1 addition & 1 deletion pkg/ddevapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ func (app *DdevApp) RenderComposeYAML() (string, error) {
extraWebContent = extraWebContent + "\nENV NVM_DIR=/home/$username/.nvm"
if app.NodeJSVersion != nodeps.NodeJSDefault {
extraWebContent = extraWebContent + "\nRUN npm install -g n"
extraWebContent = extraWebContent + fmt.Sprintf("\nRUN n install %s", app.NodeJSVersion)
extraWebContent = extraWebContent + fmt.Sprintf("\nRUN n install %s && ln -sf /usr/local/bin/node /usr/local/bin/nodejs", app.NodeJSVersion)
}

// Add supervisord config for WebExtraDaemons
Expand Down