question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected token error when running rosbridge with rclnodejs 0.18.0

See original GitHub issue

Since the upgrade of rclnodejs from 0.17.0 to 0.18.0 running the rosbridge (ros2-web-bridge) fails with

# node /node_modules/ros2-web-bridge/bin/rosbridge.js
/external/rclnodejs/lib/context.js:47
  static _instances = [];
                    ^

SyntaxError: Unexpected token =
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/external/rclnodejs/index.js:20:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

The environment is pretty standard, I guess:

  • docker image ros:foxy-ros-base
    • ROS 2 Foxy
    • Ubuntu 20.04.1 Focal
  • $ git submodule status
    +b082bb74a75c1773d70b2e00850468779374cd00 external/rclnodejs (0.18.0)
    +248f2ee44c525ebbd7c90e7c056ba62f3939eb02 external/ros2-web-bridge (0.3.0)
    
  • # node --version
    v10.23.1
    

We build rclnodejs and ros2-web-bridge from source in a Dockerfile with the commands

# install Nodejs
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get -y install nodejs
COPY external/ros2-web-bridge /external/ros2-web-bridge
COPY external/rclnodejs /external/rclnodejs
RUN /bin/bash -c ". /opt/ros/$ROS_DISTRO/setup.bash && npm i /external/rclnodejs && npm i /external/ros2-web-bridge"

Any idea what could be wrong? When checking out version 0.17.0 in submodule rclnodejs, it works (but with the issue in #752).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
minggangwcommented, Jan 25, 2021
1. we consider including a polyfill library such as [core-js](https://www.npmjs.com/package/core-js) to enable a more modern coding experience without introducing compat issue such as those you highlighted.

I prefer we could change the cases that use the latest features to the compatible patterns because it seems that these cases are limited.

2. update the contribution guidelines to explicitly call out the js spec level requirements for devs to adhere to.

+1 and the CI could check it too.

3. add compatibility validation to our test/CI.

Have submitted #773

0reactions
minggangwcommented, Jan 25, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - How to solve error "SyntaxError: Unexpected token '?'"
You are getting this error because you are using an older version of node that didn't support nullable for some packages.
Read more >
Error when trying to run a ros node - ROS Answers
I have this example ros publisher I have created for debugging purpose. It builds withouth any problem but when i rosrun the ros...
Read more >
How to fix Unexpected Token in JSON error (for ... - YouTube
Not a programmer? Read this! ** - If you get this error in an app you didn't make, and/or you're not a web...
Read more >
Error 'unexpected token' with Typescript : r/sveltejs - Reddit
It looks like your TypeScript setup is incorrect somehow. Did you forget to run npm install ? How did you set up this...
Read more >
Uncaught SyntaxError: Unexpected token '<' | WordPress.org
When I disable the plugin everything works, no errors and everything loads, ... Assuming you are using the latest version of all the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found