Skip to content

Installation Problem: Unexpected token { in cli.js  #6914

Closed
@Kodedyukh

Description

@Kodedyukh

Which operating system are you using:
On Ubuntu 16.04 LTS

Please describe the steps you took when trying to install Yarn and what went wrong:
After removing cmdtest and installing node I've followed steps described here https://yarnpkg.com/lang/en/docs/install/#debian-stable

But when I run
yarn --version

I get
/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. (/usr/share/yarn/bin/yarn.js:24:13)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)

Activity

ghost assigned on Jan 12, 2019
philoez98

philoez98 commented on Jan 14, 2019

@philoez98

Same for me here

mmxgn

mmxgn commented on Jan 14, 2019

@mmxgn

Same thing here

kaytotes

kaytotes commented on Jan 14, 2019

@kaytotes

Same issue here.

jeffpaulKinsta

jeffpaulKinsta commented on Jan 14, 2019

@jeffpaulKinsta

Same issue as well.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial

jeffpaulKinsta

jeffpaulKinsta commented on Jan 14, 2019

@jeffpaulKinsta

Updating nodejs resolved this for me:
IE:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

apt-get install -y nodejs

jvanus

jvanus commented on Jan 14, 2019

@jvanus

Here's a Dockerfile you can use to duplicate the issue. Includes fix from @jeffpaulKinsta

FROM debian:stretch-slim

# Setup the base OS
RUN apt-get update -qq \
 && apt-get install -y --no-install-recommends build-essential  \
    apt-transport-https curl ca-certificates gnupg2 apt-utils nodejs

# Install node from nodesource
# uncomment the next 2 lines for fix
# RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
#  && apt-get install -y nodejs

# Install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
 && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
 && apt-get update -qq \
 && apt-get install -y yarn

# Test
RUN yarn --version

Save the above to Dockerfile and run: docker build .

Kodedyukh

Kodedyukh commented on Jan 15, 2019

@Kodedyukh
Author

Okay, thank you! Everything works with nodejs update

added a commit that references this issue on Jan 16, 2019
Sx3

Sx3 commented on Jan 16, 2019

@Sx3

Updating nodejs resolved this for me:
IE:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

apt-get install -y nodejs

yeah it resolved .Great.Thank you.

mat-staszczyk

mat-staszczyk commented on Jan 17, 2019

@mat-staszczyk

@jvanus

...
# Setup the base OS
RUN apt-get update -qq \
 && apt-get install -y --no-install-recommends build-essential  \
    apt-transport-https curl ca-certificates gnupg2 apt-utils **nodejs**

# Install node from nodesource
# uncomment the next 2 lines for fix
# RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
#  && apt-get install -y **nodejs**
...

With this solution, you're installing nodejs twice. I think there is no need to do that 😃 .

40 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @alfiedotwtf@torifat@franzliedke@mmxgn@ramijames

      Issue actions

        Installation Problem: Unexpected token { in cli.js · Issue #6914 · yarnpkg/yarn