【发布时间】:2022-01-23 02:23:39
【问题描述】:
我目前正在与streamlit 一起完成网络应用程序的学士论文。 但是,我想在这里使用 vue 模板 from this github 存储库。 为此,我需要在 github 存储库中安装 Nodejs、Python 并使用 npm 或 yarn 所需的包。我想将所有东西都停靠在一个容器中。
原始设置需要此命令,包括 Python 3.6+、Node.js 和 npm
- py3 env 和 streamlit 包
$ python3 -m venv venv # create venv
$ . venv/bin/activate # activate venv
$ pip install streamlit # install streamlit
- npm install 项目的模块
$ 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
我尝试使用此 dockerfile 内容设置所有内容:
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
但在“yarn build”(或 yarn run serve)这一点上,我收到类似
TS2305: Module '"../../node_modules/vue/dist/vue"' 的模块错误导出成员“onMounted”。
(查看截图)
我做错了什么?没有 docker,在我的本地机器上,一切都按预期工作!
【问题讨论】:
标签: python node.js docker npm streamlit