构建失败:npm 错误!丢失了很多未知的包

Lau*_*mid 8 node.js npm firebase google-cloud-functions

我在我的项目中初始化了一个新的 firebase 项目。我向我的项目添加了函数,并且正在尝试部署默认的 helloWorld 函数。

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!");
});
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我收到以下错误,说它缺少很多我从未听说过的软件包。

i  functions: updating Node.js 16 function helloWorld(us-central1)...
Build failed: ...c-fn@2.1.0 from lock file
npm ERR! Missing: error-ex@1.3.2 from lock file
npm ERR! Missing: json-parse-even-better-errors@2.3.1 from lock file
npm ERR! Missing: lines-and-columns@1.2.4 from lock file
npm ERR! Missing: is-arrayish@0.2.1 from lock file
npm ERR! Missing: find-up@4.1.0 from lock file
npm ERR! Missing: ansi-styles@5.2.0 from lock file
npm ERR! Missing: react-is@18.2.0 from lock file
npm ERR! Missing: kleur@3.0.3 from lock file
npm ERR! Missing: sisteransi@1.0.5 from lock file
npm ERR! Missing: is-core-module@2.11.0 from lock file
npm ERR! Missing: path-parse@1.0.7 from lock file
npm ERR! Missing: supports-preserve-symlinks-flag@1.0.0 from lock file
npm ERR! Missing: resolve-from@5.0.0 from lock file
npm ERR! Missing: buffer-from@1.1.2 from lock file
npm ERR! Missing: escape-string-regexp@2.0.0 from lock file
npm ERR! Missing: char-regex@1.0.2 from lock file
npm ERR! Missing: glob@7.2.3 from lock file
npm ERR! Missing: is-number@7.0.0 from lock file
npm ERR! Missing: picocolors@1.0.0 from lock file
npm ERR! Missing: convert-source-map@1.9.0 from lock file
npm ERR! Missing: makeerror@1.0.12 from lock file
npm ERR! Missing: tmpl@1.0.5 from lock file
npm ERR! Missing: yallist@3.1.1 from lock file
npm ERR! Missing: ansi-styles@3.2.1 from lock file
npm ERR! Missing: escape-string-regexp@1.0.5 from lock file
npm ERR! Missing: supports-color@5.5.0 from lock file
npm ERR! Missing: color-convert@1.9.3 from lock file
npm ERR! Missing: color-name@1.1.3 from lock file
npm ERR! Missing: has-flag@3.0.0 from lock file
npm ERR! Missing: locate-path@5.0.0 from lock file
npm ERR! Missing: argparse@1.0.10 from lock file
npm ERR! Missing: sprintf-js@1.0.3 from lock file
npm ERR! Missing: p-locate@4.1.0 from lock file
npm ERR! Missing: p-limit@2.3.0 from lock file
npm ERR! Missing: p-try@2.2.0 from lock file
npm ERR! Missing: cliui@8.0.1 from lock file
npm ERR! Missing: yargs-parser@21.1.1 from lock file
npm ERR! Missing: locate-path@5.0.0 from lock file
npm ERR! Missing: p-locate@4.1.0 from lock file
npm ERR! Missing: p-limit@2.3.0 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-02-28T21_49_46_615Z-debug-0.log; Error ID: beaf8772

Functions deploy had errors with the following functions:
    helloWorld(us-central1)
Run Code Online (Sandbox Code Playgroud)

我安装了 firebase-functions 包,并让 firebase 在初始化时在设置中安装它的包。我尝试删除node_modules,删除缓存,删除锁,重新安装。我尝试从我的项目中删除 firebase 并重新初始化它。我尝试更改我的节点版本。

我实在是一无所知。

希望可以有人帮帮我!

谢谢!

Lau*_*mid 20

固定的!我通过在安装软件包后删除锁定文件来修复此问题,然后在没有锁定文件的情况下部署到 firebase。

  • 我不知道为什么这有效......但是值得称赞的人 (5认同)