Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn 1.12.1 break support for node 4 #6619

Closed
jbustamovej opened this issue Nov 1, 2018 · 6 comments
Closed

yarn 1.12.1 break support for node 4 #6619

jbustamovej opened this issue Nov 1, 2018 · 6 comments
Assignees
Labels

Comments

@jbustamovej
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?
yarn return "SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode"

If the current behavior is a bug, please provide the steps to reproduce.
➜ ~ node --version
v4.9.1
➜ ~ npm i -g yarn
/Users/joshua/.nvm/versions/node/v4.9.1/bin/yarn -> /Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn/bin/yarn.js
/Users/joshua/.nvm/versions/node/v4.9.1/bin/yarnpkg -> /Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn/bin/yarn.js
yarn@1.12.1 /Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn
➜ ~ yarn --version
/Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn/lib/cli.js:62909
let code = codeRegex();
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn/bin/yarn.js:24:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
➜ ~ npm i -g yarn@1.11.1
/Users/joshua/.nvm/versions/node/v4.9.1/bin/yarn -> /Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn/bin/yarn.js
/Users/joshua/.nvm/versions/node/v4.9.1/bin/yarnpkg -> /Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn/bin/yarn.js
yarn@1.11.1 /Users/joshua/.nvm/versions/node/v4.9.1/lib/node_modules/yarn
➜ ~ yarn --version
1.11.1

What is the expected behavior?
No syntax error

Please mention your node.js, yarn and operating system version.
node 4.9.1, mac osx 10.14.1, same problem on ubuntu and centos

@ghost ghost assigned torifat Nov 1, 2018
@ghost ghost added the triaged label Nov 1, 2018
@arcanis
Copy link
Member

arcanis commented Nov 1, 2018

This likely comes from a dependency we use, because the build pipeline hasn't changed. Maybe something added / upgraded to yarn audit.

I would definitely merge a PR that would fix this. In the meantime, you can use the yarn-legacy build (cf on the release page): I checked it and it seems to work fine.

@arcanis
Copy link
Member

arcanis commented Nov 1, 2018

Also note that Yarn 2 will drop support for Node 4 - I'd suggest to upgrade to Node 8+ if possible (it's not clear whether we'll want to support Node 6, cf this rfc).

@rally25rs
Copy link
Contributor

This should have been fixed in 1.12.1 by #6535 😕

@VincentLanglet
Copy link

Actually this is not fixed. Both node 4 and node 5 are not supported.

nvm install 4
yarn --version

or

nvm install 5
yarn --version

return the following error

/usr/local/yarn-latest/lib/cli.js:45699
  let {
      ^
SyntaxError: Unexpected token {
    at NativeCompileCache._moduleCompile (/usr/local/yarn-latest/lib/v8-compile-cache.js:226:18)
    at Module._compile (/usr/local/yarn-latest/lib/v8-compile-cache.js:172:36)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/yarn-latest/bin/yarn.js:24:13)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

@rally25rs
Copy link
Contributor

It looks like this is caused by yarn's dependency on @zkochan/cmd-shim when it was upgraded in #6804 What's weird is that in the PR, the node v4 tests pass 😕

But the upgrade to v3.1.0 added an object destructuring:

https://github.com/pnpm/cmd-shim/blob/%40zkochan/cmd-shim/3.1.0/index.js#L89-L92

and since dependencies aren't babel transpiled by default, that is getting included in the built deployment of yarn.

@arcanis any thoughts on this? It seems weird that the node v4 tests passed for that PR... unless the code is transpiled differently for the tests vs the deployment build...

@paul-soporan
Copy link
Member

Closing as we're now focusing on Yarn 2+ which dropped support for all Node versions below Node 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants