nokonoko / Uguu

Uguu is a simple lightweight temporary file host with support for drop, paste, click and API uploading.
https://uguu.se
GNU General Public License v3.0
849 stars 106 forks source link

SyntaxError: Unexpected token '.' #96

Closed 7zx closed 1 year ago

7zx commented 1 year ago

While compiling, got this error after running the command make in the newest Uguu release V1.8.0

up to date, audited 627 packages in 2s

131 packages are looking for funding
  run `npm fund` for details

22 vulnerabilities (12 moderate, 10 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
"node_modules/ejs/bin/cli.js" -f /var/www/uguu/"src/config.json" /var/www/uguu/src/templates/index.ejs -o /var/www/uguu/build/html/unmin/index.html;  "node_modules/ejs/bin/cli.js" -f /var/www/uguu/"src/config.json" /var/www/uguu/src/templates/faq.ejs -o /var/www/uguu/build/html/unmin/faq.html;  "node_modules/ejs/bin/cli.js" -f /var/www/uguu/"src/config.json" /var/www/uguu/src/templates/api.ejs -o /var/www/uguu/build/html/unmin/api.html;
"node_modules/@node-minify/cli/dist/cli.mjs" --compressor uglify-es --input /var/www/uguu/src/static/js/uguu.js --output /var/www/uguu/build/js/uguu.min.js
file:///var/www/uguu/node_modules/@node-minify/cli/dist/cli.mjs:16
      if (options2?.output?.includes("$1")) {
                   ^

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)
make: *** [Makefile:33: minify] Error 1
root@ubuntu:/var/www/uguu#
7zx commented 1 year ago

The issue was my nodejs version, if you are facing the same issue, update your nodejs to 14.16, here's how you can do it:

Install or update NVM (Node Version Manager)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

Load NVM into your current shell session

source ~/.bashrc # Or ~/.zshrc if you use Zsh

Install a newer version of Node.js

nvm install 14.16 # or a newer version (14.16 works with uguu)