1

I'm setting up cloud build trigger, how to set node version properly? this is what I get:

Already have image (with digest): gcr.io/cloud-builders/yarn yarn install v1.9.4 info No lockfile found. warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/5] Validating package.json... error functions@: The engine "node" is incompatible with this module. Expected version "10". error Found incompatible module info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

package.json:

"engines": {
  "node": "10"
}

.yaml is:

steps:
  - name: 'gcr.io/cloud-builders/yarn'
  args: ['install']
  dir: 'functions/autodeploy'

  - name: 'gcr.io/cloud-builders/npm'
  args: ['test']
  dir: 'functions/autodeploy'

  - name: 'gcr.io/cloud-builders/gcloud'
  args: ['functions', 'deploy', 'someName', '--trigger-topic', 
         'some.topic.name', '--runtime', 'nodejs10']
  dir: 'functions/autodeploy'
4

2 回答 2

1

解决方案在评论中实现了讨论,总结了问题是如何解决的:

  • 使用yarn参数 --ignore-engines 在app.yaml
  • 在构建 yaml 文件步骤中指定节点版本,因此它看起来像这样:

    steps:
    - name: 'gcr.io/cloud-builders/yarn:node-10.10.0'
      args: ['install', '--ignore-engines']
      dir: 'functions/autodeploy'
    
    - name: 'gcr.io/cloud-builders/npm:node-10.10.0'
      args: ['test']
      dir: 'functions/autodeploy'
    
    - name: 'gcr.io/cloud-builders/gcloud'
      args: ['functions', 'deploy', 'someName', '--trigger-topic', 
      'some.topic.name', '--runtime', 'nodejs10']
      dir: 'functions/autodeploy'
    
于 2019-11-11T12:50:58.640 回答
0

我有同样的错误,删除文件 yarn.lock 解决了问题

于 2020-03-01T19:30:02.850 回答