Yarn: Yarn does not start. At all.

Created on 22 Oct 2019  路  5Comments  路  Source: yarnpkg/yarn

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

  • Bug

What is the current behavior?

Every invocation produces error message:

yarn --version
/usr/share/yarn/lib/cli.js:46099
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

If the current behavior is a bug, please provide the steps to reproduce.

Installation is per docs. Here's some history:

 1301  apt-cache policy yarn
 1302  curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
 1303  sudo systemctl restart nut-server nut-client
 1304  sudo systemctl status nut-server nut-client
 1305  grafana-cli plugins install grafana-image-renderer
 1306  uname -a
 1307  sudo apt update
 1308  apt-cache policy yarn
 1309  sudo nano /etc/apt/sources.list/
 1310  ls /etc/apt/sources.list
 1311  ls /etc/apt/sources.list/
 1312  sudo nano /etc/apt/sources.list
 1313  echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
 1314  sudo apt update
 1315  apt-cache policy yarn
 1316  sudo apt install yarn
 1317  apt list --upgradable 
 1318  sudo apt update
 1319  sudo apt upgrade

And output I was able to copy-paste:

lar@rpi-lgr13-0199:~$ sudo apt install yarn
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 11 not upgraded.
Need to get 3,678 kB of archives.
After this operation, 17.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.19.1-1 [890 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Fetched 3,678 kB in 10s (339 kB/s)                                                                                                                                                         
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.19.1-1_all.deb ...
Unpacking yarn (1.19.1-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.19.1-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...

What is the expected behavior?

Expected yarn to run without error.

Please mention your node.js, yarn and operating system version.

lar@rpi-lgr13-0199:~/grafana-image-renderer$ apt-cache policy yarn node
yarn:
  Installed: 1.19.1-1
  Candidate: 1.19.1-1
  Version table:
 *** 1.19.1-1 500
        500 https://dl.yarnpkg.com/debian stable/main armhf Packages
        500 https://dl.yarnpkg.com/debian stable/main all Packages
        100 /var/lib/dpkg/status
     1.19.0-1 500
        500 https://dl.yarnpkg.com/debian stable/main armhf Packages
        500 https://dl.yarnpkg.com/debian stable/main all Packages
     1.17.3-1 500
        500 https://dl.yarnpkg.com/debian stable/main armhf Packages
        500 https://dl.yarnpkg.com/debian stable/main all Packages
...

```lar@rpi-lgr13-0199:~/grafana-image-renderer$ apt-cache policy nodejs
nodejs:
Installed: 4.2.6~dfsg-1ubuntu4.2
Candidate: 4.2.6~dfsg-1ubuntu4.2
Version table:
* 4.2.6~dfsg-1ubuntu4.2 500
500 http://ports.ubuntu.com xenial-updates/universe armhf Packages
500 http://ports.ubuntu.com xenial-security/universe armhf Packages
100 /var/lib/dpkg/status
4.2.6~dfsg-1ubuntu4 500
500 http://ports.ubuntu.com xenial/universe armhf Packages


Linux rpi-lgr13-0199 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l armv7l armv7l GNU/Linux
```

Most helpful comment

Seems this has been hiding for a while - the most recent working package for my platform is 1.12.3-1. Note I'm not impacted by cmdtest:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ apt policy cmdtest
cmdtest:
  Installed: (none)
  Candidate: 0.22-1
  Version table:
     0.22-1 500
        500 http://ports.ubuntu.com xenial/universe armhf Packages

I used apt purge and autoremove to progressively step backwards... Here's v1.19.0-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.19.0-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  yarn
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 890 kB of archives.
After this operation, 5,399 kB of additional disk space will be used.
Get:1 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.19.0-1 [890 kB]
Fetched 890 kB in 3s (223 kB/s)
Selecting previously unselected package yarn.
(Reading database ... 171785 files and directories currently installed.)
Preparing to unpack .../archives/yarn_1.19.0-1_all.deb ...
Unpacking yarn (1.19.0-1) ...
Setting up yarn (1.19.0-1) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:46094
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

And v1.17.3-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.17.3-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,678 kB of archives.
After this operation, 17.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.17.3-1 [889 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Fetched 3,678 kB in 13s (279 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.17.3-1_all.deb ...
Unpacking yarn (1.17.3-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.17.3-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:46083
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Same problem with 1.16.0-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.16.0-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,625 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Get:3 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.16.0-1 [837 kB]
Fetched 3,625 kB in 11s (311 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.16.0-1_all.deb ...
Unpacking yarn (1.16.0-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.16.0-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:45703
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Also in 1.15.2-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.15.2-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,624 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.15.2-1 [836 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Fetched 3,624 kB in 13s (267 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.15.2-1_all.deb ...
Unpacking yarn (1.15.2-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.15.2-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:45699
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

And 1.13.0-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.13.0-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,623 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Get:3 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.13.0-1 [835 kB]
Fetched 3,623 kB in 8s (419 kB/s)                                                                                                                                                                       
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.13.0-1_all.deb ...
Unpacking yarn (1.13.0-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.13.0-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:45726
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

But not in v1.12.3-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install -y yarn=1.12.3-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,621 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.12.3-1 [833 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Fetched 3,621 kB in 11s (314 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.12.3-1_all.deb ...
Unpacking yarn (1.12.3-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.12.3-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
1.12.3

All 5 comments

Seems this has been hiding for a while - the most recent working package for my platform is 1.12.3-1. Note I'm not impacted by cmdtest:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ apt policy cmdtest
cmdtest:
  Installed: (none)
  Candidate: 0.22-1
  Version table:
     0.22-1 500
        500 http://ports.ubuntu.com xenial/universe armhf Packages

I used apt purge and autoremove to progressively step backwards... Here's v1.19.0-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.19.0-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  yarn
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 890 kB of archives.
After this operation, 5,399 kB of additional disk space will be used.
Get:1 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.19.0-1 [890 kB]
Fetched 890 kB in 3s (223 kB/s)
Selecting previously unselected package yarn.
(Reading database ... 171785 files and directories currently installed.)
Preparing to unpack .../archives/yarn_1.19.0-1_all.deb ...
Unpacking yarn (1.19.0-1) ...
Setting up yarn (1.19.0-1) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:46094
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

And v1.17.3-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.17.3-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,678 kB of archives.
After this operation, 17.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.17.3-1 [889 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Fetched 3,678 kB in 13s (279 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.17.3-1_all.deb ...
Unpacking yarn (1.17.3-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.17.3-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:46083
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Same problem with 1.16.0-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.16.0-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,625 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Get:3 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.16.0-1 [837 kB]
Fetched 3,625 kB in 11s (311 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.16.0-1_all.deb ...
Unpacking yarn (1.16.0-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.16.0-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:45703
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Also in 1.15.2-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.15.2-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,624 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.15.2-1 [836 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Fetched 3,624 kB in 13s (267 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.15.2-1_all.deb ...
Unpacking yarn (1.15.2-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.15.2-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:45699
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

And 1.13.0-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install yarn=1.13.0-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,623 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Get:3 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.13.0-1 [835 kB]
Fetched 3,623 kB in 8s (419 kB/s)                                                                                                                                                                       
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.13.0-1_all.deb ...
Unpacking yarn (1.13.0-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.13.0-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
/usr/share/yarn/lib/cli.js:45726
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

But not in v1.12.3-1:

lar@rpi-lgr13-0199:~/grafana-image-renderer$ sudo apt install -y yarn=1.12.3-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1 nodejs
The following NEW packages will be installed:
  libuv1 nodejs yarn
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,621 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Get:1 http://ports.ubuntu.com xenial/universe armhf libuv1 armhf 1.8.0-1 [47.9 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main armhf yarn all 1.12.3-1 [833 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe armhf nodejs armhf 4.2.6~dfsg-1ubuntu4.2 [2,740 kB]
Fetched 3,621 kB in 11s (314 kB/s)                                                                                                                                                                      
Selecting previously unselected package libuv1:armhf.
(Reading database ... 171723 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_armhf.deb ...
Unpacking libuv1:armhf (1.8.0-1) ...
Selecting previously unselected package yarn.
Preparing to unpack .../archives/yarn_1.12.3-1_all.deb ...
Unpacking yarn (1.12.3-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.2_armhf.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:armhf (1.8.0-1) ...
Setting up yarn (1.12.3-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
lar@rpi-lgr13-0199:~/grafana-image-renderer$ yarn --version
1.12.3

Is this still an issue on v1.21.1? If so, please comment. Closing for now

I have Ubuntu 16.04 LTS.

$ apt list yarn
Listing... Done
yarn/stable,stable,stable,now 1.21.1-1 all [installed]
$ yarn
/usr/share/yarn/lib/cli.js:46099
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

It stems from Node (of course). I updated nvm to use a recent node version and yarn is fine.


Same error on yarn 1.22.4-1 on Ubuntu 18.04 LTS with all updates.

/usr/share/yarn/lib/cli.js:46099
let {
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/usr/share/yarn/bin/yarn.js:24:13)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)

I have to use Yarn on a project that uses Node 5.12.0. It would be nice to see this bug fixed so that Yarn can continue to support Node 5.

Was this page helpful?
0 / 5 - 0 ratings