1

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

  1. py3 env & streamlit package
$ python3 -m venv venv  # create venv

$ . venv/bin/activate   # activate venv

$ pip install streamlit # install streamlit
  1. npm install modules of project
$ 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!

enter image description here

1 Answer 1

1

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)

Sign up to request clarification or add additional context in comments.

1 Comment

This worked indeed! Thanks (switched back 2 npm)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.