Reputation: 288
I am currently working for bachelor thesis on a web app together with streamlit. However, I want to use a vue template from this github repository over here. For this, I need to install Nodejs, Python and using npm or yarn the needed packages inside the github repository. I want to dockerize everything in one container.
original setup needs this commands including Python 3.6+, Node.js, and npm
$ python3 -m venv venv # create venv
$ . venv/bin/activate # activate venv
$ pip install streamlit # install streamlit
$ cd my_component/frontend
$ npm install # Install npm dependencies
$ npm run serve # Start the Webpack dev server
$ . venv/bin/activate # activate the venv you created earlier
$ streamlit run my_component/__init__.py # run the example
I tried to setup everything with this dockerfile content:
FROM ubuntu:20.04
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
EXPOSE 8501
WORKDIR /app
COPY requirements.txt ./requirements.txt
RUN apt update -y && \
apt install -y git && \
apt install -y curl && \
apt install -y python3-pip && \
pip3 install -r requirements.txt && \
curl -sL https://deb.nodesource.com/setup_17.x | bash && \
apt install -y nodejs && \
node -v && \
npm -v && \
git clone https://github.com/andfanilo/streamlit-component-template-vue && \
cd streamlit-component-template-vue/my_component/frontend && \
rm -rf node_modules && \
export NODE_OPTIONS=--openssl-legacy-provider && \
npm i && \
npm run build && \
ls -a
CMD streamlit run streamlit-component-template-vue/my_component/__init__.py
But at the point "yarn build" (or yarn run serve) I receive module errors like
TS2305: Module '"../../node_modules/vue/dist/vue"' has no exported member 'onMounted'.
(Check the Screenshot)
What did I do wrong? Without docker, on my local machine, everything works as anticipated!
Upvotes: 1
Views: 389
Reputation: 7558
I am most certain the issue is caused by the line:
rm -rf package-lock.json &&
Remove that and rebuild your image.
The lock file will help keep node_modules the project relies upon at their desired versions (I.e it helps keep identical trees of dependencies everywhere)
Upvotes: 1