blitz-js / legacy-framework

MIT License
3 stars 2 forks source link

Installation fails in node 12.22.7 #375

Closed hen-x closed 2 years ago

hen-x commented 2 years ago

What is the problem?

Under node@12.22.7, the command yarn global add blitz fails at the postinstall step.

It appears that the script at packages/blitz/scripts/postinstall.js uses null-coalescing (??) syntax, which is not supported in Node 12.

Both the documentation and the engines field of Blitz indicate that Node 12 is supported.

Paste all your error logs here:

❯ node --version
v12.22.7

❯ yarn --version
1.22.17

❯ yarn global add blitz
[1/4] 🔍  Resolving packages...
[...SNIP...]
[-/6] ⠂ waiting...
error /Users/xxx/.config/yarn/global/node_modules/blitz: Command failed.
Exit code: 1
Command: node scripts/postinstall.js
Arguments: 
Directory: /Users/xxx/.config/yarn/global/node_modules/blitz
Output:
/Users/xxx/.config/yarn/global/node_modules/blitz/scripts/postinstall.js:32
      })) ?? "",
           ^

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 Function.executeUserEntryPoint [as runMain] (internal/modules/run_

Paste all relevant code snippets here:

N/A

What are detailed steps to reproduce this?

On MacOS:

  1. Run brew install node@12 && brew link node@12
  2. Run yarn global add blitz
  3. Observe that installation fails with a syntax error in the postinstall script.

Run blitz -v and paste the output here:

N/A — cannot install.

Please include below any other applicable logs and screenshots that show your problem:

No response

WNemencha commented 2 years ago

Also getting this in my project since yesterday, which prevents me to do any yarn add

$ node -v
v12.22.5

EDIT: I've done a nvm use 16 (v16.13.0) and then it does not show this error anymore. I was able to successfuly upgrade from 0.43.0 to 0.44.0 ^^

beerose commented 2 years ago

Yeah, nullish coalescing is supported from Node 14, so we should get rid of it in our post-install script.