V
V
Viktimius2021-06-19 19:47:05
Nginx
Viktimius, 2021-06-19 19:47:05

How to avoid errors when starting container with vue app??

There is an application with a front on vue, when running the docker-compose up command, the error "These dependencies were not found" is thrown, when running yarn serve/build everything is fine.

I tried to check the error by creating duplicate applications with dependencies from the original project, each time throwing out different libraries in the error.

I ask to help who faced.

Wednesday

Пакет NVM
node -v
v15.8.0

yarn -v
1.22.10



Dockerfile

FROM node:15
WORKDIR /app
COPY package.json ./
RUN  yarn install
EXPOSE 8080
CMD ["yarn", "serve"]



docker-compose.yml

version: '3'
services:
  web:
    build: .
    stdin_open: true
    tty: true
    ports: 
      - "8082:8080"
    volumes:
      - "/app/node_modules" 
      - ".:/app"



package.json

{
  "name": "",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.21.1",
    "core-js": "^3.14.0",
    "dotenv": "^8.6.0",
    "http-proxy-middleware": "^1.3.1",
    "tiptap-vuetify": "^2.24.0",
    "vue": "^2.6.11",
    "vue-axios": "^3.2.4",
    "vue-router": "^3.2.0",
    "vued3tree": "^5.1.0",
    "vuelidate": "^0.7.6",
    "vuetify": "^2.4.0",
    "vuex": "^3.4.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "sass": "~1.32.0",
    "sass-loader": "^10.0.0",
    "vue-cli-plugin-vuetify": "~2.4.1",
    "vue-template-compiler": "^2.6.11",
    "vuetify-loader": "^1.7.0"
  }
}



main.js

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vuelidate from 'vuelidate'
import vuetify from './plugins/vuetify'
import http from './services/http'
import VueAxios from 'vue-axios'
import vued3tree from 'vued3tree'

Vue.use(vuelidate)
Vue.use(VueAxios, http)
Vue.use(vued3tree)

Vue.config.productionTip = false

new Vue({
  router,
  store,
  vuetify,
  render: h => h(App)
}).$mount('#app')



What have I tried

1) Удаление node_modules и package-lock.json/yarn.lock и переустановка зависимостей
2) Установка [email protected] вместо [email protected]
3) Удаление кеша node.js
4) пробовал добавить "не найденные" либы в vue.config.js (transpileDependencies)
transpileDependencies: [
    'vuetify',
    'vued3tree',
    'vuelidate',
  ],



Screenshot of the error

60ce1e89848ea993851134.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2021-06-19
@Viktimius

COPY . .forgot after yarn install

V
Vadim, 2021-06-19
@Viji

apparently vue cannot work without its own http server, the cat will transfer static files, here is an example from the vue.js documentation
https://vuejs.org/v2/cookbook/dockerize-vuejs-app.html
The truth is here for npm, try it first with it, rehash it with yarn will work. Yes, and first just make a build image, see how it turns out - without docker-compose

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question