【问题标题】:firebase deploy problems-nodeJS versionfirebase 部署问题-nodeJS 版本
【发布时间】:2018-08-01 23:52:46
【问题描述】:

当我想用firebase部署我的项目时,我遇到了nodeJS版本问题,困扰了我很多天。 当我应用命令“firebase deploy --only functions”时,它提醒我:

i  deploying functions
Running command: npm --prefix functions install
audited 5522 packages in 8.196s
found 11 vulnerabilities (2 low, 5 moderate, 4 high)
run `npm audit fix` to fix them, or `npm audit` for details
✔  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

Error: The module 
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> 
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)

Having trouble? Try firebase deploy --help

我的节点版本是v8.11.3 我的 npm 版本是 6.2.0

谁知道怎么解决??非常感谢!!!

【问题讨论】:

  • 我尝试了所有我能找到的解决方案,例如“npm update”“npm install”,但它们都不起作用。另外,我尝试了许多其他版本的nodejs,但没有人能解决这个问题。
  • 尝试npm rebuild,或者在你的函数目录中尝试rm -rf node_modules,然后再次运行npm install
  • 不显示错误和代码的图像。将文本复制到问题本身中,以便于阅读和搜索。
  • 我试过“npm rebuild”和“rm -rf node_modules”,还有“npm install”。它们都不起作用。还有其他原因会导致这个问题吗??

标签: node.js firebase npm firebase-cli


【解决方案1】:

遇到了同样的问题。将我的 Node JS 版本更新为 v8.16.0,然后在我的 Functions / package.json 中添加了 nodeJS 引擎版本:

 "engines": { "node": "8" },

我现在可以部署我的功能了。

在这里找到答案:https://howtofirebase.com/cloud-functions-migrating-to-node-8-9640731a8acc

【讨论】:

    猜你喜欢
    • 2018-03-19
    • 1970-01-01
    • 1970-01-01
    • 2020-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-17
    相关资源
    最近更新 更多