如何在Amplify Console的置备步骤中更改节点版本 [英] How to change Node Version in Provision Step in Amplify Console

查看:55
本文介绍了如何在Amplify Console的置备步骤中更改节点版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临着无法通过AWS Amplify控制台构建Angular应用程序的问题:您正在运行Node.js的v8.12.0版本,Angular CLI 8.0+不支持该版本.支持的官方Node.js版本为10.9或更高版本.请访问 https://nodejs.org/en/以找到有关如何更新Node.js的说明."

I'm facing the problem that I cant build my Angular app through the AWS Amplify Console: "You are running version v8.12.0 of Node.js, which is not supported by Angular CLI 8.0+. The official Node.js version that is supported is 10.9 or greater. Please visit https://nodejs.org/en/ to find instructions on how to update Node.js."

现在,我想在供应步骤中将Docker容器的默认节点版本设置为VERSION_NODE_10,该版本已在容器中定义.

Now I want to set the default node version of the docker container in the provision step to VERSION_NODE_10 which is already defined in the container.

# Framework Versions
ENV VERSION_NODE_8=8.12.0
ENV VERSION_NODE_6=6
ENV VERSION_NODE_10=10
ENV VERSION_NODE_DEFAULT=$VERSION_NODE_8 <-- Change this to $VERSION_NODE_10
ENV VERSION_RUBY_2_3=2.3.6
ENV VERSION_RUBY_2_4=2.4.3
ENV VERSION_RUBY_DEFAULT=$VERSION_RUBY_2_3
ENV VERSION_HUGO=0.51
ENV VERSION_YARN=1.13.0

amplify.yml:

amplify.yml:

version: 0.1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - node -v
        - npm run-script build
  artifacts:
    baseDirectory: dist/cr-client
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

有人知道如何更改默认设置吗?

Does anyone know how to change the default?

推荐答案

AWS Amplify使用 nvm 处理节点版本.试试这个:

AWS Amplify use nvm to handle node version. Try this:

version: 0.1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - nvm use $VERSION_NODE_10
        - npm ci
    build:
      commands:
        - nvm use $VERSION_NODE_10
        - node -v
        - npm run-script build
  artifacts:
    baseDirectory: dist/cr-client
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

这篇关于如何在Amplify Console的置备步骤中更改节点版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆