jackyef / ssr-benchmarks

Simple benchmark of various SSR approaches, rendering 64k divs in a recursive way

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with `ERR_PNPM_NO_SCRIPT  Missing script: xxx`

oraluben opened this issue · comments

I followed the instructions (install pnpm, pnpm install) but cannot run the benchmark successfully. Is there some pnpm-specific configurations?

Error messages:

pnpm run build:all

> ssr-benchmarks@0.0.1 build:all /workspace/ssr-benchmarks
> pnpm run build --r

 ERR_PNPM_NO_SCRIPT  Missing script: build
 ELIFECYCLE  Command failed with exit code 1.
pnpm run bench:all

> ssr-benchmarks@0.0.1 bench:all /workspace/ssr-benchmarks
> node bench.js && node compile.js > result.md

Starting benchmark for method 'ejs'...
 ERR_PNPM_NO_SCRIPT  Missing script: bench
node:child_process:935
    throw err;
    ^

Error: Command failed: pnpm run bench --filter ejs
    at checkExecSyncError (node:child_process:861:11)
    at execSync (node:child_process:932:15)
    at /workspace/ssr-benchmarks/bench.js:12:3
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/workspace/ssr-benchmarks/bench.js:10:9)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 1290,
  stdout: null,
  stderr: null
}
 ELIFECYCLE  Command failed with exit code 1.

Looks like a pnpm usage issue, due to pnpm upgrade? After little change it works:

diff --git a/bench.js b/bench.js
index e326e7d..01a3e19 100644
--- a/bench.js
+++ b/bench.js
@@ -9,7 +9,7 @@ const methods = fs.readdirSync('./methods');
  */
 methods.forEach(method => {
   console.info(chalk.blueBright(`Starting benchmark for method '${method}'...`));
-  execSync(`pnpm run bench --filter ${method}`, {
+  execSync(`pnpm run --filter ${method} bench`, {
     stdio: 'inherit',
   });
 });
diff --git a/package.json b/package.json
index edd5ce7..d97db98 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "description": "Repo to test performance of various SSR approaches",
   "main": "index.js",
   "scripts": {
-    "build:all": "pnpm run build --r",
+    "build:all": "pnpm run --r build",
     "bench:all": "node bench.js && node compile.js > result.md"
   },
   "keywords": [