symfony encore安装在ubuntu不兼容的node.js上返回错误



安装新symfony 5.4后

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

我安装了encore如https://symfony.com/doc/current/frontend/encore/installation.html页面所述:

composer require symfony/webpack-encore-bundle

然后

yarn install

返回这个错误:

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"

即使https://symfony.com/doc/current/frontend/encore/installation.html页面也提到:"首先确保安装node .js",我认为我的实际节点是ok的(以前的symfony项目工作得很好)。

另一点是,即使我把我的ubuntu从bionic升级到focal,在默认的ubuntu存储库中安装的node.js是已弃用→10.19.0

最后,我删除旧的nodejs,然后安装n(对于法语用户,在ubuntu帮助中:https://doc.ubuntu-fr.org/nodejs#au_moyen_du_gestionnaire_de_versions_n)

最新更新