I have set up a Vue project and initialized firebase functions (using Firebase CLI). Created a function that works fine when deployed from my local machine to the cloud (both with "firebase Deploy" and "firebase deploy --only functions"). The issue arises during cloud build (during CI/CD pipeline). I get a "sh: 1: eslint: not found" error in the build log. The Vue project structure looks like this;
The build is triggered by commits to the master... the build config is as follows;
steps:
# Install
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
# Build
- name: 'gcr.io/cloud-builders/npm'
args: ['run', 'build', '--prod']
# Deploy
- name: 'gcr.io/$PROJECT_ID/firebase'
args: ['deploy']
The error occurs at the deploy step... the full build log is as follows;
Finished Step #1
Starting Step #2
Step #2: Pulling image: gcr.io/covid-info-bw/firebase
Step #2: Using default tag: latest
Step #2: latest: Pulling from covid-info-bw/firebase
Step #2: c0c53f743a40: Already exists
Step #2: 66997431d390: Already exists
Step #2: 0ea865e2909f: Already exists
Step #2: 584bf23912b7: Already exists
Step #2: 3c4c73959f29: Already exists
Step #2: 63e05266fc4b: Already exists
Step #2: 7b37ba8cd979: Already exists
Step #2: 3a18f94fe18a: Already exists
Step #2: a000f3263f8b: Already exists
Step #2: 3a5d0859c8ef: Pulling fs layer
Step #2: 575701571da4: Pulling fs layer
Step #2: 8e3be3979b6a: Pulling fs layer
Step #2: 8e3be3979b6a: Verifying Checksum
Step #2: 8e3be3979b6a: Download complete
Step #2: 575701571da4: Verifying Checksum
Step #2: 575701571da4: Download complete
Step #2: 3a5d0859c8ef: Verifying Checksum
Step #2: 3a5d0859c8ef: Download complete
Step #2: 3a5d0859c8ef: Pull complete
Step #2: 575701571da4: Pull complete
Step #2: 8e3be3979b6a: Pull complete
Step #2: Digest: sha256:35d71d1c92b972de31f223e63fd25f1be6c419f28b24c106187139c9aa3e6cfa
Step #2: Status: Downloaded newer image for gcr.io/covid-info-bw/firebase:latest
Step #2: gcr.io/covid-info-bw/firebase:latest
Step #2:
Step #2: [1m[37m===[39m Deploying to 'covid-info-bw'...[22m
Step #2:
Step #2: [1m[36mi [39m[22m deploying [1mfunctions, hosting[22m
Step #2: Running command: npm --prefix ./functions run lint
Step #2:
Step #2: > functions@ lint /workspace/functions
Step #2: > eslint .
Step #2:
Step #2: sh: 1: eslint: not found
Step #2: npm ERR! code ELIFECYCLE
Step #2: npm ERR! syscall spawn
Step #2: npm ERR! file sh
Step #2: npm ERR! errno ENOENT
Step #2: npm ERR! functions@ lint: `eslint .`
Step #2: npm ERR! spawn ENOENT
Step #2: npm ERR!
Step #2: npm ERR! Failed at the functions@ lint script.
Step #2: npm ERR! This is probably not a problem with npm. There is likely additional logging output
above.
Step #2: npm WARN Local package.json exists, but node_modules missing, did you mean to install?
Step #2:
Step #2: npm ERR! A complete log of this run can be found in:
Step #2: npm ERR! /builder/home/.npm/_logs/2020-04-16T23_28_19_649Z-debug.log
Step #2:
Step #2: [1m[31mError:[39m[22m functions predeploy error: Command terminated with non-zero exit
code1
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/covid-info-bw/firebase" failed: step exited with non-zero status: 1
Firebase.json snippet is as follows;
...
"functions": {
"predeploy": [
"npm --prefix ./functions run lint"
]
}
...
This is a link to my Repo just for reference