This relative module was not found: appears when docker composes.

Asked 2 months ago, Updated 2 months ago, 4 views

When you run the docker composition command, you get the following error and you cannot access localhost:8080.
It seems that I can't find the main.js in the src file, but when I look at the directory, it's normal, so I'm in trouble.I hope you enjoy it.

<s>[webpack.Progress] 98% after emmitting
web | ERROR Failed to compile with 2 errors 2:33:24 AM
web|
web | This relative module was not found:
web|
web    | * ./src/main.js in multi ./node_modules/@vue/cli-service/node_modules/webpack-dev-server/client/index.js ./node_modules/@vue/cli-service/node_modules/webpack/hot/dev-server.js ./src/main.js, multi ./node_modules/@vue/cli-service/node_modules/webpack/hot/dev-server.js ./node_modules/@vue/cli-service/node_modules/webpack-dev-server/client/index.js ./src/main.js

Dockerfile

 FROM node: 10.17.0-alpine 3.9
WORKDIR/zatubako
COPY package*.json./
RUN npm install
CMD ["npm", "run", "serve" ]

docker-compose.yml

version: '3.7'

services:
  web:
    container_name —web
    build:
      context:.
      dockerfile —Dockerfile
    volumes:
      - '.:/zatubako'
      - '/zatubako/node_modules'
    ports:
      - '8080:8080'

directory structure

zatubako
--docker-compose.yml
--node_modules
--src
│ - - App.vue
│ --main.js
│ --assets
│      │
│      --logo
--.babelrc             
--index.html
- - webpack.config
- -.dockerignore
--package.json
- - Dockerfile

node.js docker vue.js

2022-09-30 11:04

1 Answers

Is it OK to continue with ?

What you are seeing is the contents of the error (of which 3) on the page that is also referenced.
Try updating your webpack

package.jsonResults:

- "webpack": "^3.6.0",
+    "webpack": "^4.43.0",


2022-09-30 11:04

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.