firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Firebase function deployment fails with 'missing' dependencies error

Open ziziele opened this issue 1 year ago • 40 comments

I am encountering an error when attempting to deploy a Firebase function. Despite deleting node_modules and package-lock.json, running npm install, and executing firebase deploy --only functions many times, the build process still fails with the following error:

Build failed: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR!
npm ERR! Clean install a project
npm ERR!
npm ERR! Usage:
npm ERR! npm ci
npm ERR!
npm ERR! Options:
npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]      
npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm ERR!
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR!
npm ERR! Run "npm help ci" for more info

npm ERR! A complete log of this run can be found in:
npm ERR!     /www-data-home/.npm/_logs/2023-04-09T09_55_08_623Z-debug-0.log; Error ID: beaf8772      

Functions deploy had errors with the following functions:
        update(asia-east2)
i  functions: cleaning up build files...

Error: There was an error deploying functions

package.json

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^11.5.0",
    "firebase-functions": "^4.2.0",
    "stripe": "^12.0.0"
  },
  "devDependencies": {
    "firebase-functions-test": "^3.0.0"
  },
  "private": true,
  "engines": {
    "node": "16"
  }
}

firebase.json

{
  "functions": [
    {
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log"
      ]
    }
  ]
}

.gitignore

node_modules/

I have manually npm installed each of them but anytime I execute firebase deploy --only functions, it keeps asking for more. Now my package-lock.json has hundreds of packages.

The code I'm testing:

exports.helloWorld = functions
  .region("asia-east2")
  .https.onRequest((request, response) => {
    functions.logger.info("Hello logs!", { structuredData: true });
    response.send("Hello from Firebase!");
  });

The steps I took:

npm install -g firebase-tools

firebase login

firebase init functions - Use an existing project ...

cd functions

npm i stripe

edit index.js

firebase deploy --only functions

On the Firebase Dashboard, this function is indicated by a red triangle with the message 'Function deployment failed. Please try again.'

I have also tried updating the affected packages in my package.json file, but the error persists.

I am unsure what could be causing this issue.

ziziele avatar Apr 10 '23 00:04 ziziele

Hi ziziele, does a regular npm install add the modules when run from the functions directory? I only see an npm i stripe in the bug report which may not install all required modules.

christhompsongoogle avatar Apr 11 '23 16:04 christhompsongoogle

Hi Chris,

I initially used npm i stripe only once before deploying my code. However, when I deployed it, I encountered an error, which prompted me to delete the node_modules folder and package_lock.json file. Afterward, I ran npm install, all inside the functions directory.

Despite repeating these steps several times, the error persisted. To troubleshoot the error, I manually installed the request packages indicated in the error message using npm install. However, as I installed more packages, it required more whenever I ran firebase deploy --only functions. My package-lock.json file now contains hundreds of packages.

ziziele avatar Apr 12 '23 00:04 ziziele

Is this a problem with Firebase or is the project corrupted? Is it possible to reproduce the error in a fresh project?

christhompsongoogle avatar Apr 12 '23 00:04 christhompsongoogle

Hi Chris, I've just tested with a fresh project and it has the same error.

These were the steps I took:

  1. npm install firebase-functions@latest firebase-admin@latest --save
  2. npm install -g firebase-tools
  3. firebase login
  4. firebase init functions
  5. JavaScript
  6. npm install
  7. cd functions and modified the existing index.js to:
const functions = require("firebase-functions");

// // Create and deploy your first functions
// // https://firebase.google.com/docs/functions/get-started
//
exports.helloWorld = functions.https.onRequest((request, response) => {
  functions.logger.info("Hello logs!", { structuredData: true });
  response.send("Hello from Firebase!");
});
  1. firebase deploy --only functions

I have attached all the necessary files, including the firebase.json and the functions/package.json files, and the output log of the firebase-debug.log after running the deploy command with the debug flag. error.zip

ziziele avatar Apr 12 '23 00:04 ziziele

Hi Chris,

I posted it on StackOverFlow and this is the right answer: https://stackoverflow.com/a/76044520/12640100

After reading a similar issue, I see that they recommend downgrading firebase-tools to 10.0.0, 10.8.0, 11.17.0, 11.18.0, 11.20.0, or 11.22.0. Mostly they prefer to downgrade it to 11.17.0.

npm i -g [email protected]

Or at least it works for me.

ziziele avatar Apr 18 '23 20:04 ziziele

Following the steps above but I'm not able to repro

Node: v18.13.0 firebase-tools version: 11.25.3 OS: Ubuntu variant

Based on the S.O. Answer it's a problem finding functions.yaml - I'll continue investigating

Question: Do you have anything non-default in npmrc?

npm config list

christhompsongoogle avatar Apr 18 '23 21:04 christhompsongoogle

Also @ziziele - do you mind sharing the version of node you are using locally and the version you are specifying when deploying to GCF?

e.g.

node -v

taeold avatar Apr 18 '23 22:04 taeold

Hi @taeold. I face the same issue with Firebase 11.27.0. I've recently upgraded my version of node from 16.16 to 18.16. The problem occurs in both cases.

desk-pro avatar Apr 20 '23 01:04 desk-pro

Possibly related S.O. question https://stackoverflow.com/questions/76121723/what-is-functions-yaml

christhompsongoogle avatar Apr 28 '23 20:04 christhompsongoogle

I've been chasing this problem all evening, I changed the engine field in the package.json file from 18 to 16 and it works after removing the node_module and running npm install. I was able to get the cloud function to also update by changing the engine to 18 BUT not running npm install. The error reappears soon as I change the engine back to 18, remove the node_modules and run npm install again.

I am running the latest firebase-tools, firebase-admin, and firebase-functions.

Update: Removing the package-lock.json file before deploying seems to fix it everytime.

choleaoum avatar May 08 '23 09:05 choleaoum

Hey @ziziele. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar May 17 '23 01:05 google-oss-bot

Same issue and this resolves it:

Update: Removing the package-lock.json file before deploying seems to fix it everytime.

Node.js v18.16.0. Firebase 12.1.0 npm 9.6.7 Windows 11

vbackeberg avatar May 20 '23 16:05 vbackeberg

I've been chasing this problem all evening, I changed the engine field in the package.json file from 18 to 16 and it works after removing the node_module and running npm install. I was able to get the cloud function to also update by changing the engine to 18 BUT not running npm install. The error reappears soon as I change the engine back to 18, remove the node_modules and run npm install again.

I am running the latest firebase-tools, firebase-admin, and firebase-functions.

Update: Removing the package-lock.json file before deploying seems to fix it everytime.

You should not remove the package-lock before deployment. That is a security and potential breaking change nightmare waiting to happen.

michaelangeloio avatar May 27 '23 19:05 michaelangeloio

Since there haven't been any recent updates here, I am going to close this issue.

@ziziele if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Jun 01 '23 01:06 google-oss-bot

This issue is not solved. While deploying the latest functions build success. But in logs the same error. Screenshot 2023-06-21 at 12 36 00 PM

{ "protoPayload": { "@type": "type.googleapis.com/google.cloud.audit.AuditLog", "status": { "code": 3, "message": "Build failed: ...: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! Missing: [email protected] from lock file\nnpm ERR! \nnpm ERR! Clean install a project\nnpm ERR! \nnpm ERR! Usage:\nnpm ERR! npm ci\nnpm ERR! \nnpm ERR! Options:\nnpm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]\nnpm ERR! [-E|--save-exact] [-g|--global]\nnpm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]\nnpm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]\nnpm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]\nnpm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]\nnpm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]\nnpm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]\nnpm ERR! \nnpm ERR! aliases: clean-install, ic, install-clean, isntall-clean\nnpm ERR! \nnpm ERR! Run \"npm help ci\" for more info\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /www-data-home/.npm/_logs/2023-06-21T06_17_19_692Z-debug-0.log; Error ID: beaf8772" }, "authenticationInfo": {}, "serviceName": "cloudfunctions.googleapis.com", "methodName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", "resourceName": "projects/content-magic-tool/locations/us-central1/functions/authOnCreate" }, "insertId": "-oekmvud1nti", "resource": { "type": "cloud_function", "labels": { "region": "us-central1", "project_id": "content-magic-tool", "function_name": "authOnCreate" } }, "timestamp": "2023-06-21T06:17:31.521862Z", "severity": "ERROR", "logName": "projects/content-magic-tool/logs/cloudaudit.googleapis.com%2Factivity", "operation": { "id": "operations/Y29udGVudC1tYWdpYy10b29sL3VzLWNlbnRyYWwxL2F1dGhPbkNyZWF0ZS9XSjhET183UDZkSQ", "producer": "cloudfunctions.googleapis.com", "last": true }, "receiveTimestamp": "2023-06-21T06:17:32.401975695Z" }

Rajdeep-Das avatar Jun 21 '23 07:06 Rajdeep-Das

Since there haven't been any recent updates here, I am going to close this issue.

@ziziele if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Jun 22 '23 01:06 google-oss-bot

I'm encountering the exact same issue. Builds fine, but when trying to deploy, getting multiple errors all looking the same :

Build failed: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file

I recently upgraded to node 18.

All the versions would be :

  • node : v18.16.1
  • npm : 9.7.2
  • firebase (cli) : 12.4.6
  • firebase-functions: "^4.4.1"
  • windows : 10

I removed node_modules and package-lock.json before doing a clean npm install with the same errors at the end.

I investigated a few of the packages :

  • p-limit (2.3.0) is indeed missing from the package-lock.json but seems required by :
`-- [email protected]
  `-- @google-cloud/[email protected]
    `-- [email protected]
  • cliui (8.0.1) is also missing but required by :
+-- [email protected]
| `-- @google-cloud/[email protected]
|   `-- [email protected]
|     `-- @grpc/[email protected]
|       `-- [email protected]
|         `-- [email protected]
`-- [email protected]
  `-- @firebase/[email protected]
    +-- @grpc/[email protected]
    | `-- @grpc/[email protected]
    |   `-- [email protected]
    |     `-- [email protected]
    `-- @grpc/[email protected]
      `-- [email protected]
        `-- [email protected]
  • path-exists (3.0.0), p-try (2.2.0) is not in package-lock.json but npm list p-try returns nothing, so...

Not sure if that means anything as I never had to bother checking for that kind of stuff before, so I lack comparisons on that, but maybe that will give an idea to someone more knowledgeable than me on that topic.

Also FWIW, I'm trying to deploy functions v1 and v2.

By removing the package-lock.json, all the v1 functions managed to deploy, and the v2 failed, but that was my mistake as I had calls to functions.config(). I'll have to look into that, but that's unrelated.

As my project is 2 years old, I wondered if I'm not missing anything that was added afterwards. So I created a new project and its functions folder, uncommented the helloWorld function and tried to deploy it, with the same error (as @ziziele) did.

sebastien-f avatar Jul 31 '23 16:07 sebastien-f

How I solved the issue.

This issue started appearing while deploying my cloud functions a week ago. I could not find a solution and was getting mad. I read and tried every information on the internet to resolve the error, but no success.

Finally, I decided to reset my machine, and then tried to redeploy the cloud function with the exact same configuration and versions and this time it worked!

Also, thoroughly comparing I found that when we install NodeJS on our machine , with all the required packages python311 also gets installed which helps in downloading of the missing dependencies mentioned in the error and i had deleted python311 folder from C drive thinking it as junk which might is causing all the trouble.

I hope my comment helps in resolving the issue!🫡 Screenshot 2023-08-07 220438

PratyakshGupta48 avatar Aug 07 '23 16:08 PratyakshGupta48

This is still not solved. I encounter exactly the same problem.

The only thing that works for me is deleting package-lock.json before deployment. However, as @michaelangeloio has already pointed out, this is not a good idea.

Edit: I also tried npm config set legacy-peer-deps false and npm ci as suggested here, but it did not work. Contrary to @sebastien-f, I am experiencing the issue on a Mac.

paul019 avatar Oct 01 '23 15:10 paul019

Removing package-lock seems fine to me.

sewellstephens avatar Oct 03 '23 02:10 sewellstephens

Removing package-lock seems fine to me.

https://stackoverflow.com/a/54127283/111625. Short version :

Conclusion: don't ever delete package-lock.json.

That being said, in many scenarios that won't be an issue, but why makes the symptom disappear instead of curing the illness ?

sebastien-f avatar Oct 03 '23 11:10 sebastien-f

This is still not solved. I encounter exactly the same problem.

The only thing that works for me is deleting package-lock.json before deployment. However, as @michaelangeloio has already pointed out, this is not a good idea.

Edit: I also tried npm config set legacy-peer-deps false and npm ci as suggested here, but it did not work. Contrary to @sebastien-f, I am experiencing the issue on a Mac.

After running the config set command from npm, try running npm config list to make sure that it was taken into account. You should see a line with : legacy-peer-deps = false, not starting with a ;.

If that's not it, if you can share somewhere the full error log from google cloud console regarding the deployment, I can offer to have a look at it, to see if something strikes me. If I remember correctly, firebase should provide a link to it when it fails.

sebastien-f avatar Oct 03 '23 12:10 sebastien-f

When running npm config list I indeed get legacy-peer-deps = false.

I exported the error log from Google Cloud Console (see below). However, as it is very long and repetitive in the middle, I replaced one part with ....

Thank you very much in advance!

Error log
2023-10-03 15:07:12.794 CEST
Step #2 - "build": Already have image (with digest): europe-west3-docker.pkg.dev/gae-runtimes/gcp/buildpacks/google-gae-18/nodejs/builder:nodejs_20231002_RC00


2023-10-03 15:07:13.590 CEST
Step #2 - "build": ===> ANALYZING


2023-10-03 15:07:14.071 CEST
Step #2 - "build": Timer: Analyzer started at 2023-10-03T13:07:14Z


2023-10-03 15:07:14.108 CEST
Step #2 - "build": Image with name "europe-west3-docker.pkg.dev/flutter-test2-af2a7/gcf-artifacts/http__users__create_user:latest" not found


2023-10-03 15:07:14.226 CEST
Step #2 - "build": Timer: Analyzer ran for 154.735085ms and ended at 2023-10-03T13:07:14Z


2023-10-03 15:07:14.226 CEST
Step #2 - "build": ===> DETECTING


2023-10-03 15:07:14.236 CEST
Step #2 - "build": Timer: Detector started at 2023-10-03T13:07:14Z


2023-10-03 15:07:14.378 CEST
Step #2 - "build": google.nodejs.runtime 1.0.0


2023-10-03 15:07:14.378 CEST
Step #2 - "build": google.utils.archive-source 0.0.1


2023-10-03 15:07:14.378 CEST
Step #2 - "build": google.nodejs.npm 1.0.0


2023-10-03 15:07:14.378 CEST
Step #2 - "build": google.nodejs.functions-framework 0.9.4


2023-10-03 15:07:14.378 CEST
Step #2 - "build": google.config.entrypoint 0.9.0


2023-10-03 15:07:14.378 CEST
Step #2 - "build": google.utils.label-image 0.0.2


2023-10-03 15:07:14.378 CEST
Step #2 - "build": Timer: Detector ran for 142.091722ms and ended at 2023-10-03T13:07:14Z


2023-10-03 15:07:14.378 CEST
Step #2 - "build": ===> RESTORING


2023-10-03 15:07:14.378 CEST
Step #2 - "build": Timer: Restorer started at 2023-10-03T13:07:14Z


2023-10-03 15:07:14.602 CEST
Step #2 - "build": Restoring metadata for "google.nodejs.runtime:node" from cache


2023-10-03 15:07:14.604 CEST
Step #2 - "build": Restoring metadata for "google.nodejs.npm:npm_modules" from cache


2023-10-03 15:07:14.604 CEST
Step #2 - "build": Restoring data for "google.nodejs.runtime:node" from cache


2023-10-03 15:07:14.604 CEST
Step #2 - "build": Restoring data for "google.nodejs.npm:npm_modules" from cache


2023-10-03 15:07:17.231 CEST
Step #2 - "build": Timer: Restorer ran for 2.85228193s and ended at 2023-10-03T13:07:17Z


2023-10-03 15:07:17.231 CEST
Step #2 - "build": ===> BUILDING


2023-10-03 15:07:17.231 CEST
Step #2 - "build": Timer: Builder started at 2023-10-03T13:07:17Z


2023-10-03 15:07:17.246 CEST
Step #2 - "build": === Node.js - Runtime ([email protected]) ===


2023-10-03 15:07:17.246 CEST
Step #2 - "build": Using runtime version from GOOGLE_RUNTIME_VERSION: 16.20.2


2023-10-03 15:07:17.247 CEST
Step #2 - "build": ***** CACHE HIT: "nodejs"


2023-10-03 15:07:17.247 CEST
Step #2 - "build": Node.js v16.20.2 cache hit, skipping installation.


2023-10-03 15:07:17.249 CEST
Step #2 - "build": Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.


2023-10-03 15:07:17.249 CEST
Step #2 - "build": Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.


2023-10-03 15:07:17.249 CEST
Step #2 - "build": Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.


2023-10-03 15:07:17.264 CEST
Step #2 - "build": === Utils - Archive Source ([email protected]) ===


2023-10-03 15:07:17.363 CEST
Step #2 - "build": Adding image label google.source-archive: /workspace/.googlebuild/source-code.tar.gz


2023-10-03 15:07:17.380 CEST
Step #2 - "build": === Node.js - Npm ([email protected]) ===


2023-10-03 15:07:17.414 CEST
Step #2 - "build": ***** CACHE MISS: "npm_modules"


2023-10-03 15:07:17.582 CEST
Step #2 - "build": Installing application dependencies.


2023-10-03 15:07:18.042 CEST
Step #2 - "build": --------------------------------------------------------------------------------


2023-10-03 15:07:18.042 CEST
Step #2 - "build": Running "npm ci --quiet (NODE_ENV=production)"


2023-10-03 15:07:26.408 CEST
Step #2 - "build": npm


2023-10-03 15:07:26.408 CEST
Step #2 - "build": ERR! code EUSAGE


2023-10-03 15:07:26.457 CEST
Step #2 - "build": npm


2023-10-03 15:07:26.457 CEST
Step #2 - "build":


2023-10-03 15:07:26.457 CEST
Step #2 - "build": ERR!


2023-10-03 15:07:26.458 CEST
Step #2 - "build":


2023-10-03 15:07:26.458 CEST
Step #2 - "build": npm


2023-10-03 15:07:26.458 CEST
Step #2 - "build": ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.


2023-10-03 15:07:26.458 CEST
Step #2 - "build": npm ERR!


2023-10-03 15:07:26.458 CEST
Step #2 - "build":


2023-10-03 15:07:26.458 CEST
Step #2 - "build": npm


2023-10-03 15:07:26.458 CEST
Step #2 - "build": ERR!

2023-10-03 15:07:26.458 CEST
Step #2 - "build": Missing: [email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: @jest/[email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: @jest/[email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: [email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: [email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: @jest/[email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: @jest/[email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: @jest/[email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: @jest/[email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: [email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: [email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm ERR! Missing: [email protected] from lock file


2023-10-03 15:07:26.459 CEST
Step #2 - "build": npm

...

2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR!


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! Clean install a project


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR!


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! Usage:


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! npm ci


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR!


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! Options:


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR!


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! aliases: clean-install, ic, install-clean, isntall-clean


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR!


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! Run "npm help ci" for more info


2023-10-03 15:07:26.490 CEST
Step #2 - "build":


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! A complete log of this run can be found in:


2023-10-03 15:07:26.490 CEST
Step #2 - "build": npm ERR! /www-data-home/.npm/_logs/2023-10-03T13_07_18_417Z-debug-0.log


2023-10-03 15:07:26.491 CEST
Step #2 - "build": Timer: Builder ran for 9.259496916s and ended at 2023-10-03T13:07:26Z


2023-10-03 15:07:26.491 CEST
Step #2 - "build": ERROR: failed to build: exit status 1

paul019 avatar Oct 03 '23 13:10 paul019

It's a bit different from what I had (not by a large account, but still). If you did not tried it yet, what you could also do would be moving your node_modules and package-lock.json outside of your project directory (you could delete them also, but you never know) and then run npm install again, then try to deploy it, just to make sure that it's really up to date with your project.

Also, not sure if you can, but I'd try copying the project to another computer (even a virtual machine), then npm install and then trying to deploy it from that other machine, just to see if that's not something specific on your mac.

sebastien-f avatar Oct 03 '23 15:10 sebastien-f

Thank you! I already tried to delete node_modules and package-lock.json and run npm install again. Unfortunately, that did not work.

I will try to run it on a Windows machine (or virtual machine) later.

paul019 avatar Oct 03 '23 15:10 paul019

I am also experiencing this. It is very strange, but once the functions emulator fails to start up, the next time it succeeds in starting up the emulator.

# fail!!
$ cd functions && rm -rf build && npm ci && firebase emulators:start --only functions
# success!!
$ cd functions && rm -rf build && npm ci && firebase emulators:exec --only functions "echo hello" && firebase emulators:start --only functions

ytetsuro avatar Dec 12 '23 03:12 ytetsuro

I am still experiencing this issue.

npm ERR! npm ERR! npm ci can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with npm install before continuing. npm ERR! npm ERR! Missing: [email protected] from lock file npm ERR! npm ERR! Clean install a project npm ERR! npm ERR! Usage: npm ERR! npm ci npm ERR! npm ERR! Options: npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling] npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] npm ERR! [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]] npm ERR! [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit] npm ERR! [--no-bin-links] [--no-fund] [--dry-run] npm ERR! [-w|--workspace [-w|--workspace ...]] npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links] npm ERR! npm ERR! aliases: clean-install, ic, install-clean, isntall-clean npm ERR! npm ERR! Run "npm help ci" for more info

ekaram avatar Feb 13 '24 14:02 ekaram

remove package-lock.json. thats what ive been doing and its worked for months ever since

sewellstephens avatar Feb 13 '24 22:02 sewellstephens

@ekaram it may not be best idea or even good practice, but at the end of the day that's all that works and has ever. no other solutions above do sh*t

sewellstephens avatar Feb 13 '24 22:02 sewellstephens

I am getting this error when i am trying to tsc --watch. If a code throws an exception inside a function i try to change the code and build the project the code is built but i get this error

dzivoing avatar Mar 05 '24 07:03 dzivoing