bug report:
current behavior:
when running "npm --global install" in order to upgrade to latest yarn version (1.13.0) using node version 4.9.1 and then running 'yarn -v' we get the following error:
/usr/local/lib/node_modules/yarn/lib/cli.js:45726
let {
^
SyntaxError: Unexpected token {
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.<anonymous> (/usr/local/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)
expected behavior:
as behaves when using previous yarn versions (e.g 1.12.3):
npm --global install yarn
npm --global install [email protected]
yarn -v
should succeed with no errors.
Same error,
Reinstalling with nodesource/distributions worked for me
Ran into the same issue today. Thanks for mentioning the working version. That helped me with an interim fix.
/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)
On ubuntu 16.04
The engines field in the package.json reports ">= 4.0.0". This version should be removed from npm and a new version should be published with the correct engines field, and probably a major version bump since it is a breaking change to drop support for a major version of node.
same here. Centos 7, npm 3.8.3, node 5.1.0, yarn 1.12 . Downgraded to 1.7 and gonna see.
Make sure your user has access to Node + NPM. For Ubuntu, try installing yarn from apt-get as per the Yarn docs for the Yarn Debian Stable Install. I triggered this issue but performed the troubleshooting above and resolved it.
Ubuntu 16.04, Node v8.11.3, NPM 5.6.0, Yarn 1.13.0
Alternatively as a work around you can also just remove the package and install an older version (I was getting the same errors above listed in the nightlies)
wget https://nightly.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.9.0-20180719.1538_all.deb
sudo apt install ./yarn_1.9.0-20180719.1538_all.deb
The comment in #6914 solved the problem by updating Node to v10:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt-get install -y nodejs
succesful,thanks!
mactype uninstall is a problem
In case you are using Ansible with packages from Ansible Galaxy..
After also having above error - this playbook below solved yarn installing perfectly for me:
- hosts: all
roles:
- geerlingguy.nodejs
- ocha.yarn
become: yes
become_user: root
become_method: sudo
Most helpful comment
Alternatively as a work around you can also just remove the package and install an older version (I was getting the same errors above listed in the nightlies)