首页 > 解决方案 > 在 docker 下安装 vue/cliapp 时出错

问题描述

我想在 docker 下安装我的@vue/cli 4.0.5 应用程序并使用https://medium.com/@jwdobken/vue-with-docker-initialize-develop-and-build-51fad21ad5e6链接:我修改了命令行:从 11-alpine 修改节点源并重命名项目名称并安装项目,但运行命令

yarn serve

我收到未找到服务的错误:

me@athoe:/mnt/_work_sdb8/wwwroot/lar/VApps/DOCKER_TEST$ mkdir vtaskproject && cd "$_" && docker run --rm -v "${PWD}:/$(basename `pwd`)" -w "/$(basename `pwd`)" -it node:11-alpine sh -c "yarn global add @vue/cli && vue create ."
Unable to find image 'node:11-alpine' locally
11-alpine: Pulling from library/node

e7c96db7181b: Already exists 
0119aca44649: Pull complete 
40df19605a18: Pull complete 
82194b8b4a64: Pull complete 
Digest: sha256:8bb56bab197299c8ff820f1a55462890caf08f57ffe3b91f5fa6945a4d505932
Status: Downloaded newer image for node:11-alpine

yarn global v1.15.2
[1/4] Resolving packages...
warning @vue/cli > @vue/cli-ui > vue-cli-plugin-apollo > apollo > git-parse > babel-polyfill > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning @vue/cli > @vue/cli-ui > vue-cli-plugin-apollo > apollo > git-parse > babel-polyfill > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.21.1", while you're on "1.15.2".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
success Installed "@vue/cli@4.1.1" with binaries:
      - vue
Done in 32.17s.
?  Your connection to the default yarn registry seems to be slow.
   Use https://registry.npm.taobao.org for faster installation? Yes


Vue CLI v4.1.1
? Generate project in current directory? Yes


Vue CLI v4.1.1
? Please pick a preset: default (babel, eslint)
? Pick the package manager to use when installing dependencies: Yarn


Vue CLI v4.1.1
���  Creating project in /vtaskproject.
���  Installing CLI plugins. This might take a while...

yarn install v1.15.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.


success Saved lockfile.
Done in 77.43s.
����  Invoking generators...
����  Installing additional dependencies...

yarn install v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
Done in 24.82s.
���  Running completion hooks...

����  Generating README.md...

����  Successfully created project vtaskproject.
����  Get started with the following commands:

 $ yarn serve

me@athoe:/mnt/_work_sdb8/wwwroot/lar/VApps/DOCKER_TEST/vtaskproject$ yarn serve
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'serve'
serge@athoe:/mnt/_work_sdb8/wwwroot/lar/VApps/DOCKER_TEST/vtaskproject$ yarn --version
0.32

我看到在成功安装时选择了新创建的项目目录。

同样在提供的文章中,下一个是:

Dockerfile Dockerfile 与文档中给定的示例相同。只有构建阶段分为安装阶段和构建阶段,因为我们在开发时不需要构建!

但薄是我在创建的项目中没有看到任何 Dockerfile 文件:https ://imgur.com/a/mKrdFgi 正如我所料。是否有 Dockerfile 以及下一步如何移动?

$ lsb_release -d; uname -r; uname -i
Description:    Ubuntu 18.04.3 LTS
4.15.0-72-generic
x86_64
$ docker --version 
Docker version 19.03.5, build 633a0ea838

标签: dockervuejs2vue-cli-3

解决方案


推荐阅读