docker 运行 2个egg示例后出现错误,其中一个正常,另外一个起不来
详细报错信息如下
> puppeteer-service@1.0.0 dev
> egg-bin dev
node:internal/fs/utils:323
throw err;
^
Error: ENOENT: no such file or directory, open '/www/typings/app/index.d.ts'
at Object.openSync (node:fs:505:3)
at Object.readFileSync (node:fs:401:35)
at /www/node_modules/egg-ts-helper/dist/index.js:173:42
at Array.forEach (<anonymous>)
at TsHelper.cleanFiles (/www/node_modules/egg-ts-helper/dist/index.js:171:14)
at TsHelper.build (/www/node_modules/egg-ts-helper/dist/index.js:114:14)
at register (/www/node_modules/egg-ts-helper/dist/register.js:42:42)
at Object.<anonymous> (/www/node_modules/egg-ts-helper/dist/register.js:17:9)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/www/typings/app/index.d.ts'
}
Error: /www/node_modules/egg-bin/lib/start-cluster {"declarations":true,"tscompiler":"ts-node/register","workers":1,"baseDir":"/www","framework":"/www/node_modules/egg"} exit with code 1
at ChildProcess.<anonymous> (/www/node_modules/common-bin/lib/helper.js:56:21)
at Object.onceWrapper (node:events:476:26)
at ChildProcess.emit (node:events:369:20)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
code: 1
}
npm notice
npm notice New patch version of npm available! 7.20.3 -> 7.20.5
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.20.5>
npm notice Run `npm install -g npm@7.20.5` to update!
npm notice
docker 基本配置
version: "3.9"
services:
egg:
build: .
command:
- sh
- -c
- 'nginx && npm run dev'
ports:
- "8000:8000"
- "9222:9222"
- "81:80"
volumes:
- .:/www
hostname: "egg"
egg-consume:
build: .
command:
- sh
- -c
- 'nginx && npm run dev'
ports:
- "8001:8000"
- "9223:9222"
- "82:80"
volumes:
- .:/www
DockerFile 文件
FROM node:15-alpine
WORKDIR /www
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --update chromium nginx
RUN npm install npm -g
RUN npm config set registry=http://registry.npm.taobao.org
COPY package.json package.json
RUN yarn install
COPY nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /run/nginx
COPY ./ /www
CMD nginx && EGG_SERVER_ENV=prod npm start
相关环境信息
操作系统 windows10 , Docker version 19.03.13
Node 版本:15-alpine
Egg 版本:2.15.1
1条答案
按热度按时间z0qdvdin1#
Error: ENOENT: no such file or directory, open '/www/typings/app/index.d.ts'
dev 只在开发期使用,它会写入文件