Problem when installing in Dockerfile
See original GitHub issueI am trying to create a Dockerfile for easy startup of the bridge and I encountered this error during call to npm install
:
rclnodejs@0.15.2 install /root/ros2-web-bridge/node_modules/rclnodejs
> node-gyp rebuild
[eval]:1
console.log(process.env.AMENT_PREFIX_PATH.replace(/:/g, '/include/ ') + '/include/')
^
TypeError: Cannot read property 'replace' of undefined
at [eval]:1:43
at Script.runInThisContext (vm.js:131:20)
at Object.runInThisContext (vm.js:297:38)
at Object.<anonymous> ([eval]-wrapper:10:26)
at Module._compile (internal/modules/cjs/loader.js:1118:30)
at evalScript (internal/process/execution.js:94:25)
at internal/main/eval_string.js:23:3
gyp: Call to 'node -e "console.log(process.env.AMENT_PREFIX_PATH.replace(/:/g, '/include/ ') + '/include/')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
I am running foxy on ubuntu focal. On my native setup I can install and run it.
This is the Dockerfile I am using. It may help others too.
FROM ubuntu:focal
# distro download link has to be adopted also if you change the distro var
ENV ROS_DISTRO=foxy
ENV GIT_USER_NAME mrbuild
ENV GIT_USER_EMAIL mrbuild@github.com
RUN apt update && apt install -y git locales python curl wget
RUN locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt install -y gnupg2 lsb-release
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
RUN sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
# Install prerequisites
RUN export DEBIAN_FRONTEND=noninteractive && apt update && apt install -y \
build-essential \
cmake \
python3-colcon-common-extensions \
python3-pip \
python3-rosdep \
libpython3-dev \
cppcheck
RUN rosdep init
RUN rosdep update
# Configure git
RUN git config --global user.name $GIT_USER_NAME \
&& git config --global user.email $GIT_USER_EMAIL
# Get ROS2 latest package
ENV ROS2_WS=/root
WORKDIR $ROS2_WS
RUN wget https://github.com/ros2/ros2/releases/download/release-foxy-20200807/ros2-foxy-20200807-linux-focal-amd64.tar.bz2 \
&& tar xf ros2-foxy-20200807-linux-focal-amd64.tar.bz2
RUN rosdep install --from-paths $ROS2_WS/ros2-linux/share --ignore-src --rosdistro $ROS_DISTRO -y --skip-keys "console_bridge fastcdr fastrtps libopensplice67 libopensplice69 osrf_testing_tools_cpp poco_vendor rmw_connext_cpp rosidl_typesupport_connext_c rosidl_typesupport_connext_cpp rti-connext-dds-5.3.1 tinyxml_vendor tinyxml2_vendor urdfdom urdfdom_headers"
RUN echo "source $ROS2_WS/ros2-linux/local_setup.bash" >> $HOME/.bashrc
# Install Node.js
RUN curl -o- https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh | bash
RUN apt install nodejs
RUN bash -c ". /opt/ros/$ROS_DISTRO/setup.bash"
RUN cd && git clone https://github.com/RobotWebTools/ros2-web-bridge.git && cd ros2-web-bridge && git checkout develop
WORKDIR /root/ros2-web-bridge/
# change rclnodejs version
RUN npm install -g dot-json && dot-json package.json dependencies.rclnodejs ^0.15.2
RUN npm install
CMD node bin/rosbridge.js
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Workarounds for common problems - Docker Documentation
Docker Desktop fails to start when anti-virus software is installed . Some anti-virus software may be incompatible with Hyper-V and Microsoft Windows 10...
Read more >Docker Desktop installation failed - Stack Overflow
Reboot your computer after running the commands above. My problem was that a broken WMI and the commands above should fix it. Share....
Read more >Installing Docker: Fixes for common problems - IBM
Installing Docker: Fixes for common problems · First issue: Boot2Docker Start doesn't work · Problem: The Boot2Docker Start shortcut doesn't run.
Read more >How To Install Docker Desktop And Troubleshoot Issues In ...
Type and search Services in the windows search box or open run then type services.msc and click Ok. Then you will see a...
Read more >9 Common Dockerfile Mistakes - Runnablog - Runnable
9 Common Dockerfile Mistakes · 1. Running apt-get · 2. Using ADD instead of COPY · 3. Adding your entire application directory in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to get it to work using this:
It could be great if you share your Dockerfile with us. I still have problems when install ros2-web-bridge in Dockerfile. Thanks