The latest LTS version of Node.js is pre-installed the newest PHP container.
This was a deliberate decision in order to keep the PHP containers as small as possible, but still provide the convenience of having these tools available.
If your PHP-based website requires an older PHP, that's ok. Keep running it in the older PHP container and use the newest PHP container for Node.js based tooling.
Make sure you are inside the newest PHP container. For example:
devin 83
Then check the version of Node.js:
node -v
If you get an error like bash: node: command not found
, you're using the wrong command shell. This might also be because you're using outdated aliases.
Follow the "Daily Shortcuts" section again in the README to update your aliases. Then run devin 83
again and check the Node.js version.
If you're manually running docker exec -it php83 bash
, you'll need to update the command to docker exec -it php83 zsh
(ie. use ZSH instead of BASH).
It's likely that you'll want to use a range of Node.js version for your projects, so we've pre-installed NVM to make switching between them easy.
List all currently installed versions:
nvm ls
Install an older version (eg. v18.x):
nvm install 18
Start using a specific version (eg. v18.x):
nvm use 18
Check which version is currently active:
node -v
Discover the other features of NVM:
nvm --help
Sure, just run:
nvm install node
Please note the latest version may be newer than the current LTS version, so be aware of the potential for breaking changes in your projects.
devin 83
cd example-site
npm run dev