krausest / js-framework-benchmark

A comparison of the performance of a few popular javascript frameworks
https://krausest.github.io/js-framework-benchmark/
Apache License 2.0
6.86k stars 842 forks source link

npm run bench-all gives me a: SyntaxError: Unexpected token '.' #1024

Closed ivanceras closed 2 years ago

ivanceras commented 2 years ago
npm run bench-all

gives me this error

FORKING:  01_run1k  BatchSize  12
<home>/js-framework-benchmark/webdriver-ts/node_modules/lighthouse/lighthouse-core/runner.js:70
      const axeVersion = artifacts.Accessibility?.version;
                                                 ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (<home>/js-framework-benchmark/webdriver-ts/node_modules/lighthouse/lighthouse-core/index.js:8:16)
krausest commented 2 years ago

That's strange. Can you please post your node --version ?

ivanceras commented 2 years ago

Here is the version of the pre-requisites

npm --version
7.22.0

node --version
v10.19.0

java -version
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

javac -version
javac 11.0.14.1

Linux 5.13.0-39-generic
krausest commented 2 years ago

Thanks and sorry the README is outdated for the node.js version, I'll fix that soon. Can you please update to node 16? The docker build currently uses 16.13.2, on OSX I use a 16.14.2, so the latest LTS node 16 release should do fine.

ivanceras commented 2 years ago

So, I just installed a new version of node and put in my application in home directory.

node --version
v16.14.2

I think I also made a mistake of trying to install webpack via apt, causing my node v12 to downgrade to use the pacakge manager's nodev10 version.

sudo apt install webpack

Running the command

npm run results

seems to attempt to install webpack-cli in the script but failed to do so.

CLI for webpack must be installed.
  webpack-cli (https://github.com/webpack/webpack-cli)

We will use "npm" to install the CLI via "npm install -D webpack-cli".
Do you want to install 'webpack-cli' (yes/no): yes
Installing 'webpack-cli' (running 'npm install -D webpack-cli')...

up to date, audited 79 packages in 3s

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

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
Error: Cannot find module 'webpack-cli/package.json'
Require stack:
- <home>/js-framework-benchmark/webdriver-ts/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at runCli (<home>/js-framework-benchmark/webdriver-ts/node_modules/webpack/bin/webpack.js:65:26)
    at <home>/js-framework-benchmark/webdriver-ts/node_modules/webpack/bin/webpack.js:154:5
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '<home>/js-framework-benchmark/webdriver-ts/node_modules/webpack/bin/webpack.js'
  ]
}

I'm not quite sure if issuing npm audit fix really fix this issues. I keep issuing them but it seems to have no effect.

ivanceras commented 2 years ago

So, I tried issuing npm install webpack-cli, without the -D flag and it seem to install it successfully.

npm install webpack-cli

up to date, audited 521 packages in 1s

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

found 0 vulnerabilities

However running the npm run results produce a new set of errors:

[webpack-cli] Failed to load '<home>/js-framework-benchmark/webdriver-ts-results/webpack.config.js' config
[webpack-cli] Error: Cannot find module 'html-webpack-plugin'

Perhaps, there should be a script which would install the prerequisites.

krausest commented 2 years ago

There shouldn't be a need to install webpack via apt or any other way manually. Webpack is installed automatically when you invoke npm ci (or npm install) in webdriver-ts-results. According to step 1.5 in the README you must invoke cd webdriver-ts-results and invoke npm ci in that directory. Did you do that? As a check: Is there a webpack and webpack-cli in webdriver-ts-results/node_modules/.bin ?

ivanceras commented 2 years ago

Ah, I missed that step.

I think I see the results of keyed/vanillajs in the table now.

Thank you!

One last thing, Is there a way to run all the benchmark for all the frameworks without having to invoke the benchmark individually for each of the frameworks?

krausest commented 2 years ago

Great + yes, of course: Just run npm run bench in the main directory and npm run results when all benchmarks finished.

krausest commented 2 years ago

And just to make sure: To build all frameworks you can invoke npm run build-prod in the root dir.

ivanceras commented 2 years ago

I also seem to be getting an error of outdated version of chrome:

type: object  instance of Error true  Message:  session not created: This version of ChromeDriver only supports Chrome version 99
Current browser version is 86.0.4240.111 with binary path /usr/bin/google-chrome

I will have to update my chrome

krausest commented 2 years ago

Yes. Chromedriver got very picky about the supported chrome version and allows according to my experience only +- 1 versions.

krausest commented 2 years ago

Please reopen this issue if you run into further issues.