symfony encore installation return errors on incompatible node.js under ubuntu

Viewed 30

After installed fresh symfony 5.4 with

composer create-project symfony/website-skeleton myprojectname-sf5.4 ^5.4.9

I installed encore as mentioned in https://symfony.com/doc/current/frontend/encore/installation.html page:

composer require symfony/webpack-encore-bundle

then

yarn install

which returns this error :

error @symfony/webpack-encore@2.1.0: The engine "node" is incompatible with this module. \
Expected version "^12.13.0 || >=14.0.0". Got "10.19.0"
1 Answers

Even if https://symfony.com/doc/current/frontend/encore/installation.html page also mentioned : "First make sure you install Node.js", I thought my actual node was ok (previous symfony projects works fine).

The other point is, even if I upgrade my ubuntu from bionic to focal, installed node.js in default ubuntu repository is deprecated -> 10.19.0

Finally, I remove old nodejs, then installed with n (or for french users, in ubuntu help : https://doc.ubuntu-fr.org/nodejs#au_moyen_du_gestionnaire_de_versions_n )

Related