Cannot deploy functions, rules or indexes
Asked by Wayne Kaskie:

I started testing out pipelines here will a full featured repo. The pipelines failed. Eventually, I troubleshot it down to discover that the issue is not with hosting, but the other features. The one I care most about is firebase functions.

The error is that ts-lint is missing. This makes me think that the problem has to do with "functions" not being at the root and the pipeline doesn't "understand" that. This repo, also has a front end so it's impractical to put functions at the root.

I run npm install, but this only works for the root project. I also added this to my pipeline:

\`npm --prefix ./function install ./function

and that didn't seem to help either, as per here: <https://stackoverflow.com/questions/13498403/npm-install-dependencies-for-a-package-in-a-different-folder>

Anyone have and solve this problem?

Wayne

ERROR:

i deploying functions, hosting Running command: npm --prefix "$RESOURCE_DIR" run lint> functions@ lint /opt/atlassian/pipelines/agent/build/functions> tslint --project [tsconfig.json](https://bitbucket.org/wafka/smart-flip-admin/src/9719bdb01e55ba3a24042d245d0da95d7805d2a4/tsconfig.json)sh: 1: tslint: not foundnpm ERR! file shnpm ERR! code ELIFECYCLEnpm ERR! errno ENOENTnpm ERR! syscall spawnnpm ERR! functions@ lint: `tslint --project tsconfig.json`npm ERR! spawn ENOENTnpm ERR! npm ERR! Failed at the functions@ lint script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm WARN Local [package.json](https://bitbucket.org/wafka/smart-flip-admin/src/9719bdb01e55ba3a24042d245d0da95d7805d2a4/package.json) exists, but node_modules missing, did you mean to install?npm ERR! A complete log of this run can be found in:npm ERR! /root/.npm/_logs/2020-09-10T14_12_48_386Z-debug.logError: functions predeploy error: Command terminated with non-zero exit code1? Deployment failed.


Answers:
author: Wayne Kaskie
body: After updating my question, I realized that what I attempted was correct. I just needed to spell the folder name correctly!

The command to add to the pipeline is:

npm --prefix ./functions install ./functions

note that I was missing the S. That fixes the tslint issue. Now, I have another one.

comments: author: ktomk
body: Good to see, and makes sense that the install failed previously.


author: ktomk
body: From the error reporting and especially the warning, it looks like that [\`npm install\`](https://docs.npmjs.com/cli/install) has not been run.

As each pipeline step is running in a new container with only the git project checkout by default (your mileage may vary, options are available):

Check the life cycles of the tooling are complete in each pipeline step. E.g. when using \`npm\`, \`npm install\` is normally required.

At least it sounds reasonable to me that this could be the reason that the [\`tslint\` utility](https://palantir.github.io/tslint/) is not available.

Just an educated guess: Are you using npm to manage tslint via the [tslint package](https://www.npmjs.com/package/tslint)?

comments: author: Wayne Kaskie
body: That is my guess as well, however, I don't know how to remedy it. I can't be the only person using the firebase pipeline for functions.


author: ktomk
body: Guess so, but I'm pretty sure you're not the only person using npm :).

Unrelated to the install issue, I've seen that tslint is deprecated. When you have things up and running, might be something you'd like to look into.


Tags: bitbucket-pipelines

cloud

deployment

firebase

google