You are most likely here because you encountered an issue when installing your Flex Plugin. Don't panic!
The Flex CLI plugin is only supported on Node versions (^16.x | ^18.x | ^20.x), so later versions like the current at the time of writing (22.x) may cause issues.
When using the latest version of Node, you may have encountered the error below:
Or a combo of both:
As you can see from the error description, the node version is "incompatible " and the plugin installation failed. Therefore we need to roll-back to one of the later versions listed.
Node has a versioning manager built in called “NVM” or Node Version Manager. This has made it very easy for developers like us to roll back their version of Node at any given time with a simple use of the NVM command.
To install NVM (Node Version Manager) using Homebrew on macOS, follow these steps:
Install Homebrew:
If you haven't already installed Homebrew, you can do so by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install NVM with Homebrew:
Run the following command to install NVM:
brew install nvm
Set Up NVM:
After installing NVM, you need to set up the environment variables. Add the following lines to your shell configuration file (~/.bashrc, ~/.zshrc, or ~/.profile):
Copy code:
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
If you're using zsh, add these lines to ~/.zshrc. For bash, add them to ~/.bashrc.
Reload Shell Configuration:
After updating the shell configuration file, reload it:
source ~/.bashrc
Or
source ~/.zshrc
Verify NVM Installation:
To verify that NVM is installed, you can show the installed version by entering:
nvm --version
The version number should be returned if installed
Using NVM to Install and Switch Node.js Versions
- Install a Specific Node.js Version:
Use the following command to install a specific version of Node.js:
nvm install <version>
For example, to install Node.js version 18.20.4
nvm install 18.20.4
- Switch to a Specific Node.js Version:
Now we need to switch versions. Use the following command to switch to a specific version of Node.js. For this example, we will be using Version 18.20.4
nvm use 18.20.4
By following these steps, you should be able to install NVM using Homebrew and manage different versions of Node.js on your system. Your results should look similar to below:
Installing the Twilio Flex CLI Plugin:
Once you have then rolled back to an older version of Node (^16.x | ^18.x | ^20.x), you should now be able to install the Twilio CLI Plugin with the following command:
twilio plugins:install @twilio-labs/plugin-flex
Still Having Trouble?
Contact Twilio's Support team. We can help investigate what went wrong and point you in the right direction. Please open a support request & make sure to include your versions as well as any verbose logs.