我正在使用 express、docker 和 Kubernetes 编写一个 node.js 应用程序。node -v 是 v12.16.3 Docker 版本 19.03.1,使用 minikube 构建 74b1e89e8a Kubernetes
我创建了一个名为 auth 的服务,当我尝试使用 skaffold dev 命令部署它时,出现以下错误
[91m[auth-depl-56db74bf85-b2kst auth] ←[0m
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mUsing ts-node version 8.10.2, typescript version 3.9.5
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mTypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0m at Object.watch (fs.js:1441:11)
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0m at add (/app/node_modules/filewatcher/index.js:74:34)
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0m at /app/node_modules/filewatcher/index.js:93:5
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0m at FSReqCallback.oncomplete (fs.js:176:5)
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! code ELIFECYCLE
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! errno 1
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! auth@1.0.0 start: `ts-node-dev src/index.ts --poll`
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! Exit status 1
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR!
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! Failed at the auth@1.0.0 start script.
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0m
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! A complete log of this run can be found in:
←[91m[auth-depl-56db74bf85-b2kst auth] ←[0mnpm ERR! /root/.npm/_logs/2020-06-05T09_25_50_079Z-debug.log
bwlow 是 package.json 文件
{
"name": "auth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "ts-node-dev src/index.ts --poll"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@types/express": "^4.17.6",
"express": "^4.17.1",
"nodemon": "^2.0.4",
"typescript": "^3.9.5"
},
"devDependencies": {
"ts-node-dev": "^1.0.0-pre.44"
}
}
泊坞窗文件
FROM node:lts-alpine
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "start"]
下面是 skaffold.yaml
apiVersion: skaffold/v2alpha3
kind: config
deploy:
kubectl:
manifests:
- ./infra/k8s/*
build:
local:
push: false
artifacts:
- image: xxxxxx/auth
context: auth
docker:
dockerfile: Dockerfile
sync:
manual:
- src: 'src/**/*.ts'
dest: .