【问题标题】:devDependencies in node js application in flex app engineflex 应用程序引擎中节点 js 应用程序中的 devDependencies
【发布时间】:2019-03-13 10:52:41
【问题描述】:

在 GAE 的标准环境中,package.json 中的 devDevependencies 是ignored。但是Flexible environment 没有这样的限制。但是,我在尝试将我的应用程序部署到 GAE 时收到未找到包裹的错误。 这是我的 app.yaml:

runtime: nodejs
env: flex

还有我的 package.json:

{
  "main": "index.js",
  "scripts": {
    "dev": "nodemon -w ./server bin/runServer -e js,json",
    "build:client": "parcel build client/index.html",
    "start": "npm run build:client && cross-env NODE_ENV=production node ./bin/runServer"
  },
  "dependencies": {
    "@material-ui/core": "^3.1.2",
    "@material-ui/icons": "^3.0.1",
    "classnames": "^2.2.6",
    "express": "^4.16.3",
    "lodash": "^4.17.11",
    "material-ui": "^0.20.2",
    "morgan": "^1.9.1",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-loadable": "^5.5.0",
    "react-multi-lang": "^1.0.2",
    "react-router": "^4.3.1",
    "react-router-dom": "^4.3.1",
    "whatwg-fetch": "^3.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.1.2",
    "@babel/plugin-proposal-class-properties": "^7.1.0",
    "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/preset-env": "^7.1.0",
    "@babel/preset-react": "^7.0.0",
    "@babel/register": "^7.0.0",
    "cross-env": "^5.2.0",
    "nodemon": "^1.18.4",
    "parcel": "^1.10.1",
    "parcel-bundler": "^1.10.1"
  }
}

【问题讨论】:

    标签: node.js google-app-engine app-engine-flexible


    【解决方案1】:

    我上次检查时,App Engine 没有安装 devDependencies,因为它默认使用 npm install --production。如果你想确保安装这些,你有几个选择:

    1. 您可以将所有内容移至 dependencies 部分
    2. 您可以定义自己的Dockerfile,并在开始之前在其中运行常规npm install
    3. (可能是最好的)您可以使用Multi-stage docker build 在第一阶段执行您的构建步骤,并生成一个仅包含您需要的不同的更纤薄的图像。

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2015-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多