【问题标题】:docker-compose up command throwing error when deploying a parse server部署解析服务器时 docker-compose up 命令抛出错误
【发布时间】:2021-01-01 22:37:48
【问题描述】:

我正在尝试在 docker 中运行我的解析服务器应用程序,但是在运行命令 'docker-compose up' 时它运行良好几秒钟,然后抛出此错误: 解析命令行时出错:无法识别的选项“--break-mongo”。 在此之后它还会引发与 npm 相关的错误 --

我的解析应用程序 |
我的解析应用程序 | > app@1.0.0 启动 /parse-server
我的解析应用程序 | > 解析服务器“/解析服务器/config/config.json”
我的解析应用程序 |
我的解析应用程序 | /parse-server/node_modules/parse/lib/node/ParseObject.js:1301
我的解析应用程序 |异步存在(选项
我的解析应用程序 | ^^^^^^
我的解析应用程序 |
我的解析应用程序 | SyntaxError:意外的标识符
我的解析应用程序 |在 createScript (vm.js:56:10)
我的解析应用程序 |在 Object.runInThisContext (vm.js:97:10)
我的解析应用程序 |在 Module._compile (module.js:549:28)
我的解析应用程序 |在 Object.Module._extensions..js (module.js:586:10) 我的解析应用程序 |在 Module.load (module.js:494:32)
我的解析应用程序 |在 tryModuleLoad (module.js:453:12)
我的解析应用程序 |在 Function.Module._load (module.js:445:3)
我的解析应用程序 |在 Module.require (module.js:504:17)
我的解析应用程序 |在需要(内部/module.js:20:19)
我的解析应用程序 |在对象。 (/parse-server/node_modules/parse/lib/node/ParseRole.js:12:43)
我的解析应用程序 |
我的解析应用程序 | npm 错误! Linux 4.19.128-microsoft-standard
我的解析应用程序 | npm 错误! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "/parse-server/config/config.json"
我的解析应用程序 | npm 错误!节点 v6.17.1
我的解析应用程序 | npm 错误! npm v3.10.10
我的解析应用程序 | npm 错误!代码生命周期
我的解析应用程序 | npm 错误! app@1.0.0 开始:parse-server "/parse-server/config/config.json"
我的解析应用程序 | npm 错误!退出状态 1
我的解析应用程序 | npm 错误!
我的解析应用程序 | npm 错误!在 app@1.0.0 启动脚本失败 '解析服务器“/parse-server/config/config.json”'。
我的解析应用程序 | npm 错误!确保您拥有最新版本的 安装了 node.js 和 npm。
我的解析应用程序 | npm 错误!如果你这样做,这很可能是一个问题 应用程序包,
我的解析应用程序 | npm 错误!不是 npm 本身。
我的解析应用程序 | npm 错误!告诉作者这在你的失败 系统:
我的解析应用程序 | npm 错误!解析服务器 “/parse-server/config/config.json”
我的解析应用程序 | npm 错误!您可以获得有关如何打开 此项目的问题:
我的解析应用程序 | npm 错误! npm 错误应用程序
我的解析应用程序 | npm 错误!或者,如果这不可用,您可以获取他们的 信息来自:
我的解析应用程序 | npm 错误! npm 所有者 ls 应用程序
我的解析应用程序 | npm 错误!可能有额外的日志输出 以上。
我的解析应用程序 |
我的解析应用程序 | npm 错误!请在任何文件中包含以下文件 支持请求:
我的解析应用程序 | npm 错误! /parse-server/npm-debug.log
my-parse-app 以代码 1 退出

我的 docker-compose:

version: "2"
services:
# Node.js parse-server application image
  app:
    build: ./app
    command: npm start -- /parse-server/config/config.json
    container_name: my-parse-app
    volumes:
    - ./app:/parse-server/
    - /parse-server/node_modules
    ports:
    - "1337:1337"
    links:
    - mongo
# MongoDB image 

  mongo:
    image: mongo:latest
    container_name: mongo-database
    ports:
    - "27017:27017"
    volumes_from:
    - mongodata
# MongoDB image volume for persistence
  mongodata:
    image: mongo
    volumes:
    - ./data/db:/data/db
    command:
    - --break-mongo

我的 Dockerfile

FROM node:boron
RUN mkdir -p /parse-server
WORKDIR /parse-server
COPY . /parse-server
RUN npm install
EXPOSE 1337
CMD ["npm","start"]

The break-mongo error

The npm error

【问题讨论】:

  • 正如@DaviMacêdo 提到的,这是一个NodeJS 版本问题。从您的docker-compose 文件中,更改需要在您的“./app”文件夹中的Dockerfile 中进行。

标签: docker npm docker-compose parse-server


【解决方案1】:

看起来您使用的是旧版本的节点,这可能是问题所在。将 docker 文件的第一行切换为:

FROM node:erbium

【讨论】:

    猜你喜欢
    • 2022-07-21
    • 2019-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 1970-01-01
    • 2021-03-29
    • 2021-06-13
    相关资源
    最近更新 更多