Default npm packages are installed twice for LTS
In this example the default packages are installed for lts and 14.17.0 versions:
~
➜ asdf install nodejs lts
Installing alias lts as 14.17.0
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3835 0 3835 0 0 26267 0 --:--:-- --:--:-- --:--:-- 26267
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 32.3M 100 32.3M 0 0 2539k 0 0:00:13 0:00:13 --:--:-- 2770k
node-v14.17.0-linux-x64.tar.gz: OK
Installing browserslist npm package... SUCCESS
Installing lite-server npm package... SUCCESS
Installing nodemon npm package... SUCCESS
Installing npm-check-updates npm package... SUCCESS
Installing npm npm package... SUCCESS
Linking "lts" to "14.17.0"
Installing browserslist npm package... SUCCESS
Installing lite-server npm package... SUCCESS
Installing nodemon npm package... SUCCESS
Installing npm-check-updates npm package... SUCCESS
Installing npm npm package... SUCCESS
The packages are not actually being duplicated in disk, they are being reinstalled in the same directory behind the scenes, is like calling npm install twice for the same version, the second time will see that the package is already installed and do nothing.
But yeah the duplicated text is confusing
Yes, I understand. But it takes a significant amount of time to start the installation the second time. For the mentioned packages it takes 1m 9s to install the first time and 47s for the second time.
Also installing all packages with one command will speed up the process, but nothing will be installed if some package name is wrong, so I'm not sure if that's the best approach.
We changed the way aliases work on #348, now you need to explicitly opt-in with dynamic ranges on legacy version files (.tool-versions and .nvmrc). The .tool-versions file doesn't support non-deterministic versions, and supporting it on .tool-versions is not a feature we are seeking to implement at the moment.
To enable it, you need to provide an ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY environment variable choosing between the latest_available and latest_installed strategies, you can read more about it in the appropriate section on the README of the project. To make this choice permanent you can export said variable from your shell rc file like so:
export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_installed
# OR
export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_available
Please update the plugin by running asdf plugin-update nodejs. If a new issue arises with the new implementation please open a new issue.
That should solve the issue of double installing packages