Grunt watch在Kubernetes中抛出一个sync:dev not found错误与Sails.js
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Grunt watch在Kubernetes中抛出一个sync:dev not found错误与Sails.js相关的知识,希望对你有一定的参考价值。
我使用Minikube来模拟我的Kubernetes生产架构。在集群中,我需要创建一个网站,我决定使用Sails.js。
这是我的Kubernetes配置:
apiVersion: v1
kind: PersistentVolume
metadata:
name: white-label-storage-persistent-volume
labels:
type: local
app: white-label
role: master
tier: backend
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/white-label-data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: white-label-storage-persistent-volume-claim
labels:
app: white-label
role: master
tier: backend
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: white-label-deployment
labels:
app: white-label
role: master
tier: backend
spec:
replicas: 1
strategy:
type: RollingUpdate
selector:
matchLabels:
app: white-label
role: master
tier: backend
template:
metadata:
labels:
app: white-label
role: master
tier: backend
spec:
containers:
- name: white-label
image: pastel-white-label:v1
imagePullPolicy: IfNotPresent
workingDir: "/usr/src/app"
resources:
requests:
memory: 2Gi
cpu: 1
limits:
memory: 4Gi
cpu: 2
ports:
- containerPort: 1337
protocol: TCP
volumeMounts:
- mountPath: "/data"
name: white-label-persistent-volume
volumes:
- name: white-label-persistent-volume
persistentVolumeClaim:
claimName: white-label-storage-persistent-volume-claim
---
apiVersion: v1
kind: Service
metadata:
name: white-label-service
labels:
app: white-label
role: master
tier: backend
spec:
type: LoadBalancer
ports:
- port: 1337
protocol: TCP
nodePort: 30003
selector:
app: white-label
role: master
tier: backend
sessionAffinity: None
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: white-label-hpa
labels:
app: white-label
role: master
tier: backend
namespace: default
spec:
maxReplicas: 5
minReplicas: 1
scaleTargetRef:
apiVersion: extensions/v1
kind: Deployment
name: white-label-deployment
targetCPUUtilizationPercentage: 80
这里是粉彩白色标签:v1 Docker图像:
FROM node:10.13.0-stretch
WORKDIR /usr/src/app
COPY . ./
RUN npm install -g sails npm-check-updates
RUN npm install @sailshq/connect-redis --save
RUN npm install
CMD ["sails", "lift"]
当我启动我的集群并构建我的pod时,一切都像魅力一样。我的Sails.js日志一尘不染,我可以在浏览器中看到主页:没问题。我在开箱即用的Web应用程序模式下使用Sails.js v1.1.0。我也可以看到Grunt已经发布并正在观看。
现在,如果我编辑.less文件,我会变得不友好:
debug: -------------------------------------------------------
error: ** Grunt :: An error occurred. **
error:
------------------------------------------------------------------------
Aborted due to warnings.
Running "watch" task
Waiting...
>> File "assets/styles/styleguide/colors.less" changed.
Loading "sync.js" tasks...ERROR
>> TypeError: Cannot read property 'length' of undefined
Warning: Task "sync:dev" not found.
我确定我的.less文件没有错误(十六进制代码版本),我的.temp文件夹是可写的(触摸.tmp / foo正在工作)我相信Grunt已正确安装,因为它开箱即用...
然后我真的不知道这里发生了什么......
你们有个主意吗?
谢谢你
我认为你正在遇到this。看起来它特定于节点版本。您可以尝试使用早期版本的节点docker镜像:
FROM node:8.12.0-stretch
正如您在docker文件中所述
FROM节点:10.13.0-stretch
如果您仍想使用节点10.x +并避免此错误,您可以使用此处讨论的方法。好又简单:)
https://github.com/balderdashy/sails/issues/4513#issuecomment-468389534
以上是关于Grunt watch在Kubernetes中抛出一个sync:dev not found错误与Sails.js的主要内容,如果未能解决你的问题,请参考以下文章
Grunt Watch致命错误:听EACCES和livereload
Grunt watch 错误 - 等待...致命错误:观看 ENOSPC
在构造函数中抛出 ArgumentNullException?