Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
busybox/node.js在Kubernetes下运行时给出ELF语法错误_Node.js_Docker_Kubernetes_Busybox - Fatal编程技术网

busybox/node.js在Kubernetes下运行时给出ELF语法错误

busybox/node.js在Kubernetes下运行时给出ELF语法错误,node.js,docker,kubernetes,busybox,Node.js,Docker,Kubernetes,Busybox,我的node.js kubernetes dev服务器陷入崩溃循环。日志显示: /bin/busybox:1 ELF ^ SyntaxError: Invalid or unexpected token at wrapSafe (internal/modules/cjs/loader.js:992:16) at Module._compile (internal/modules/cjs/loader.js:1040:27) at Object.Module._extens

我的node.js kubernetes dev服务器陷入崩溃循环。日志显示:

/bin/busybox:1
ELF
^
SyntaxError: Invalid or unexpected token
    at wrapSafe (internal/modules/cjs/loader.js:992:16)
    at Module._compile (internal/modules/cjs/loader.js:1040:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:776:16)
    at Function.executeUserEntryPoint [as runMain (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
stream closed                                                                                                                          
我通过
kubectl descripe
找到了正在运行的映像,并在shell中运行它。它应该正在运行(从
Dockerfile
):

所以我在shell中运行:

❯ dsh myregistry/project/server:R4SUGQt
+dsh:1> docker run --rm -it --entrypoint sh myregistry/project/server:R4SUGQt -c '{ command -v zsh && exec zsh -il ;} || { command -v bash && bash -il ;} || { command -v ash && ash -il ;}'
/bin/ash
06884c20d5cc:/app# node --max-old-space-size=4096 --enable-source-maps node_modules/.bin/rollup -cw

而且它工作得很好。那么这个错误是从哪里来的呢?堆栈中的所有路径都跟踪内部(
internal/modules/…
)而不是来自我的脚本或汇总

我正在使用
node:alpine
作为我的基础映像,它当前位于节点v14.11.0上


直接运行它

docker run --rm myregistry/project/server:R4SUGQ
不会再现错误


运行

docker run -it myregistry/project/server:R4SUGQt node_modules/.bin/rollup -cw
工作很好。。。我的
CMD
语法有问题吗

CMD ['node_modules/.bin/rollup','-cw']

这是我在
CMD
中使用的单引号

在事件发生后发现此reddit帖子:

真是浪费时间。。。把这个问题留在这里,以防其他人遇到类似的错误,也许这对他们来说是个好问题

CMD ['node_modules/.bin/rollup','-cw']