10

So I recently upgraded my app from Angular 7 to Angular 8 and I'm having issues with the node version of the cloud build VM as Angular 8 requires node version 10.9 or greater as shown below:

error

How can I upgrade the node version of the Google cloud VM so I won't get this error again?

Thanks.

Jack_b_321
  • 848
  • 8
  • 22

6 Answers6

30

Ok, so after hours of Googling around it turns out Google cloud platform offers a registry of different npm cloud builders for use with Google cloud build.

I could have solved my issue by creating my own docker image but I wanted to avoid this in favour of the default cloud builders docker image. I changed my cloudbuild.yaml file to include the following builder 'gcr.io/cloud-builders/npm:node-10.10.0' instead of 'gcr.io/cloud-builders/npm' this then updated the node version to node 10.10.0 and just like magic Angular 8 can now be built by google cloud build!

Specific node versions from the cloud builders repository can be found here: https://console.cloud.google.com/gcr/images/cloud-builders/GLOBAL/npm

cloudbuild.yaml file

Jack_b_321
  • 848
  • 8
  • 22
12

As suggested by their documentation you should instead using an official node image and specifying the npm entrypoint:

steps:
- name: node:10.15.1
  entrypoint: npm
  args: ['install']

https://github.com/GoogleCloudPlatform/cloud-builders/blob/master/npm/README.md

39ro
  • 862
  • 1
  • 10
  • 23
9

Okay, after hours of trying to compile my new app and search on Google, there is no clear information on how to use the new version of Node.js within the Google app engine platform.

I gave myself the task of building my own file cloudbuild.yaml to be used on the Google cloud platform and this was my result, I hope it helps many who must have the same error:

steps:

# Install node packages
- name: node:10.16.3
  entrypoint: npm
  args: ['install']

# Build productive files
- name: node:10.16.3
  entrypoint: npm
  args: [ 'run', 'build', '--prod' ]

# Deploy to google cloud app engine
- name: "gcr.io/cloud-builders/gcloud"
  args: ['app', 'deploy', '--version=demo']

You can access the original file here in GitHub

Jose Caicedo
  • 131
  • 2
  • 3
1

This link has all the current versions and their tags:

https://console.cloud.google.com/gcr/images/cloud-builders/GLOBAL/npm

For example in cloudbuild.yaml I used

enter image description here

which uses the current tag.

staad
  • 796
  • 8
  • 20
0

According to latest documentation:

Cloud Build enables you to use any publicly available container image to execute your tasks. The public node image from Docker Hub comes preinstalled with npm and yarn tools

So that means we can use any Node.js tag from Docker Hub.

As for me, I changed - name: node to - name: node:lts in cloudbuild.yaml and this helped to fix Error: error:0308010C:digital envelope routines::unsupported issue with Nest.js application build step.

0

gcr.io/cloud-builders/npm is outdated as stated in https://github.com/GoogleCloudPlatform/cloud-builders/blob/master/npm/README.md

Replace

name: 'gcr.io/cloud-builders/npm'

with:

name: 'node'
entrypoint: 'npm'
Fred Klein
  • 448
  • 6
  • 13