Search code examples
ubuntu-18.04yarnpkgsymfony5webpack-encore

Yarn encore prod failing


Im trying to deploy a symfony application on my Ubuntu server.
Mind the following details.

It is a simple application but some yarn packages seem to be failing.
What can I do?

Im working with Symfony 5.

My package.json

{
  "devDependencies": {
    "@symfony/webpack-encore": "^0.30.2",
    "bootstrap": "^4.5.2",
    "jquery": "^3.5.1",
    "node-sass": "^4.14.1",
    "popper.js": "^1.16.1",
    "webpack-notifier": "^1.6.0"
  },
  "dependencies": {
    "add": "^2.0.6",
    "copy-webpack-plugin": "^6.0.3",
    "sass-loader": "^8.0.0",
    "yarn": "^1.22.4"
  },
  "name": "fluid-cms",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "---",
  "author": "---",
  "license": "MIT"
}

The following output comes out. I have tried many things.

Ubuntu 18.04.

alpha@ovhBrains:/var/www/fluid-cms$ sudo yarn encore prod
yarn run v1.22.4
$ /var/www/fluid-cms/node_modules/.bin/encore prod
Running webpack ...

/var/www/fluid-cms/node_modules/copy-webpack-plugin/node_modules/p-limit/index.js:30
        } catch {}
                ^

SyntaxError: Unexpected token {
    at NativeCompileCache._moduleCompile (/var/www/fluid-cms/node_modules/v8-compile-cache/v8-compile-cache.js:242:18)
    at Module._compile (/var/www/fluid-cms/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (/var/www/fluid-cms/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/var/www/fluid-cms/node_modules/copy-webpack-plugin/dist/index.js:10:38)
    at Module._compile (/var/www/fluid-cms/node_modules/v8-compile-cache/v8-compile-
d.

---

Another error:

@symfony/webpack-encore@0.30.2: The engine "node" is incompatible with this module. Expected version ">= 10.13.0". Got "8.10.0"

Solution

  • Once I found out the second error log it was easy to fix.
    My nodejs -v was not matching with the requirements.