node.jsfirebasenpmgoogle-cloud-functionstravis-ci

Unsupported environment in travis when deploying firebase via script, fsevents darwin


I'm upgrading my travis environment to node 20. I have a script which is deploying firebase functions.

Here is my .travis.yml

...
install: bash $HOME/build/ChangEdApps/changed-javascript/backend/shellScripts/travis-script.sh
language: node_js
node_js:
- '20'
dist: jammy

Here is the Error

i  functions: preparing functions directory for uploading...
i  functions: packaged /home/travis/build/ChangEdApps/changed-javascript/web-apps/changed-admin-app/functions (149.81 KB) for uploading
✔  functions: functions folder uploaded successfully
i  functions: updating Node.js 20 (1st Gen) function app(us-central1)...
Build failed: npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin"} (current: {"os":"linux"})
npm ERR! notsup Valid os:  darwin
npm ERR! notsup Actual os: linux

travis-script

npm i --prefix $PROJECT_DIR_PWD/web-apps/changed-admin-app/functions -f &&
npm i request firebase-functions --prefix $PROJECT_DIR_PWD/web-apps/changed-admin-app/functions &&

This module fsevents is not declared, its a peer dependency, I tried moving it to optional and doing --omit=optional, I tried variations on npm ci, I tried deleting the package-lock.json, I tried manually changing the package-lock to linux instead of darwin. I tried audits and cleaning. With deleting the package-lock and doing npm i in travis env, I'm not even sure where it's getting darwin from.

Nothing seems to work.


Solution

  • So I ended up doing this in three steps inside my travis env via deployment script

    1 rm package-lock.json

    2 npm i

    3 Then once that is done, sed -i 's/darwin/linux/g' package-lock.json

    This finally allowed me to deploy firebase functions from travis