osrf / gzweb

Web client for Gazebo classic simulation
http://gazebosim.org/gzweb
Other
62 stars 60 forks source link

node-gyp build error (syntax error) #187

Open CRH380B-6216L opened 4 years ago

CRH380B-6216L commented 4 years ago

I am trying to build gzweb inside a docker image But there's a problem during building it

/root/gzweb/node_modules/env-paths/index.js:7
const {env} = process;
      ^

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> (/root/gzweb/node_modules/node-gyp/bin/node-gyp.js:7:18)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
There are node-gyp build errors, exiting.

I am trying to build gzweb inside an instance first after copied the code at branch gzweb_1.4.0 and occurred the syntax error in node-gyp build step. My Dockerfile works like below:

FROM ros:kinetic-robot

# Install gazebo packages
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D2486D2DD83DB69272AFE98867170598AF249743 && \
    echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list && \  
    apt-get update && \
    apt-get install -y --no-install-recommends \
        ros-kinetic-gazebo-ros-pkgs ros-kinetic-gazebo-ros-control && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* 

# Install gzweb dependent packages
RUN apt-get update && \
    apt-get purge -y git && \
    apt-get install -y \
        libjansson-dev nodejs npm nodejs-legacy libboost-dev imagemagick libtinyxml-dev mercurial cmake build-essential git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* 

# clone gzweb
ENV GZWEB_WS /root/gzweb
ADD gzweb_1.4.0 $GZWEB_WS
WORKDIR $GZWEB_WS
judyanndixon commented 4 years ago

Maybe this will resolve your issue too. https://github.com/osrf/docker_images/issues/334