Rehan
Rehan

Reputation: 426

google cloud build - functions@: The engine "node" is incompatible with this module. Expected version "10"

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'

Upvotes: 1

Views: 1886

Answers (3)

Rodrigo Alves
Rodrigo Alves

Reputation: 1

For me it solved by deleting the yarn.lock file

Upvotes: 0

Simon
Simon

Reputation: 6490

I had the same error and removing the file yarn.lock resolved the problem

Upvotes: 0

Solution achieved discussing within comments, summarizing how the issue was fixed:

  • Using the yarn parameter --ignore-engines in the app.yaml
  • Specifying node version on the build yaml file steps, so it would look like this:

    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'
    

Upvotes: 1

Related Questions