[英]code: 'MODULE_NOT_FOUND' when running Docker app
I was able to build docker image but I'm not able to run it.我能够构建 docker 图像,但无法运行它。
This the command I'm using to run这是我用来运行的命令
docker run coderpc/test-server
Below is the error I see in the console.以下是我在控制台中看到的错误。
Error: Cannot find module '/test-server/src/app/server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Here's the package.json
configuration这是
package.json
配置
{
"name": "test-server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"mongodb": "^3.6.3"
},
}
Dockerfile configuration Dockerfile配置
FROM node:14
WORKDIR /fr-service/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD [ "node", "server.js" ]
Could anyone please point where I went wrong?谁能指出我哪里出错了?
from what I can see there is no server file in your app folder据我所知,您的应用程序文件夹中没有服务器文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.