问题
I have been using libicu to detect charset in my node app that runs inside of docker, ubuntu. this is done through the module node-icu-charset-detector that uses the libicu-dev
package, which I install prior to the npm package.
It all worked fine but I suddently get the error
module.js:356
Module._extensions[extension](this, filename); ^
Error: libicui18n.so.52: cannot open shared object file: No such file or directory
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/app/node_modules/node-icu-charset-detector/node-icu-charset-detector.js:1:82)
Looking into my /usr/lib/, I don't find anything icu related, but libicu-dev is installed.
This is my docker file;
# Pull base image.
FROM dockerfile/ubuntu
WORKDIR /
ADD run.sh /run.sh
#make dirs
RUN mkdir /log
RUN mkdir /app
RUN apt-get install -y supervisor libssl-dev pkg-config wget
# Install Node.js
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get install -y nodejs
# Append to $PATH variable.
RUN echo '\n# Node.js\nexport PATH="node_modules/.bin:$PATH"' >> /root/.bash_profile
ADD /supervisord.conf /etc/supervisor/conf.d/supervisord.conf
#get phantomJS
RUN apt-get install libfreetype6 libfontconfig -y
RUN cd /app
RUN npm install phantomjs &>/dev/null
#ICU
RUN apt-get install libicu-dev libicu48 -y
RUN npm install --loglevel silent &>/dev/null
RUN npm update --loglevel silent &>/dev/null
#GET NODE-Supervisor
RUN cd /
RUN npm install --loglevel silent -g supervisor
RUN chmod 755 /*.sh
CMD ["/run.sh"]
Thank you for any help regarding this issue, as I am at the end of my linux knowledge :(
回答1:
You're installing libicu 4.8, but the requested shared library is libicu 52. So you will need to either install the libicu52
package instead (if available) or download a prebuilt binary (or source code and compile) from here.
回答2:
As @mscdex has pointed out, libicu was looking for the libicu52 package. Somehow the repository got updated allowing me to pull the new libicu which depends on libicu52 that isn't available in the repository of 12.04, but in 14.04. Since there is no official trusted build of 14.04 in the docker registry, I made my own "base" ubuntu14.04 docker image which starts with 13.10 and upgrades to 14.04;
FROM ubuntu:saucy
ENV DEBIAN_FRONTEND noninteractive
# Work around initramfs-tools running on kernel 'upgrade': <http://bugs.debian.org/cgi- bin/bugreport.cgi?bug=594189>
ENV INITRD No
# Update OS.
RUN sed -i 's/saucy/trusty/g' /etc/apt/sources.list
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get dist-upgrade -y
# Install basic packages.
RUN apt-get install -y software-properties-common
RUN apt-get install -y curl git htop unzip vim wget
# Add files.
ADD root/.bashrc /root/.bashrc
ADD root/.gitconfig /root/.gitconfig
ADD root/scripts /root/scripts
RUN apt-get clean
# Set working directory.
ENV HOME /root
WORKDIR /root
CMD ["/bin/bash"]
Then in the Dockerfile of my worker, I installed libicu52 instead of libicu48 thus fixing all issues
来源:https://stackoverflow.com/questions/23173181/libicui18n-so-52-cannot-open-shared-object-file