如何在DDEV Web容器中添加和使用nvm? [英] How can I add and use nvm in a DDEV web container?
本文介绍了如何在DDEV Web容器中添加和使用nvm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前,DDEV Web容器不附带nvm(节点版本管理器)。如何通过DDEV config.yaml文件添加和使用它?
Currently, the DDEV web container does not come with nvm (node version manager). How can I add and use it via the DDEV config.yaml file?
推荐答案
借助@greggles和@heddn #ddev Slack频道(在Drupal Slack工作空间上),我使用以下启动后挂钩对其进行了操作:
With the help of @greggles and @heddn on the #ddev Slack channel (on the Drupal Slack workspace), I got it working with the following post-start hook:
hooks:
post-start:
- exec: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
- exec: rm -f ../.nvmrc && export NVM_DIR="$HOME/.nvm" && source "$NVM_DIR/nvm.sh" && nvm install 8.11.1 && nvm use 8.11.1
这将安装nvm,然后将节点设置为版本8.11.1
This installs nvm then sets node to version 8.11.1
-麦克
这篇关于如何在DDEV Web容器中添加和使用nvm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文