“Cannot deploy to Firebase Hosting” 可以翻译为 “无法部署到 Firebase Hosting”。

huangapple go评论91阅读模式
英文:

Cannot deploy to Firebase Hosting

问题

抱歉,以下是翻译好的内容:

尽管我能够成功构建我的React应用并在本地运行,但当我尝试部署到Firebase Hosting时,我遇到了以下错误:

internal/modules/cjs/loader.js:59
const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
                                                               ^

TypeError: require(...).internalModuleStat 不是一个函数

有任何想法吗?

作为提示,这是在我开始在项目中使用sql.js之后发生的,这也导致了由于react-scripts使用webpack 5而导致的构建错误。我能够通过使用polyfill插件或降级react-scripts来解决这些问题,但无论哪种情况,firebase部署都会出现上述错误。

英文:

Although I am able to build my React app successfully and run locally, when I try to deploy to Firebase Hosting I get the following error:

internal/modules/cjs/loader.js:59
const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
                                                               ^

TypeError: require(...).internalModuleStat is not a function

Any ideas?

As a hint, this started happening after I started using sql.js in my project which also gave me build errors due to react-scripts using webpack 5. I was able to fix those with a polyfill plugin or by just downgrading react-scripts but in either case firebase deploy fails with the above error.

答案1

得分: 1

NODE_OPTIONS='' firebase deploy

基于:https://stackoverflow.com/questions/71087088/npm-run-coverage-fails-with-require-internalmodulestat-is-not-a-function

完全随机,但现在它起作用了。

英文:

Turns out I had to set

NODE_OPTIONS='' firebase deploy

Based on: https://stackoverflow.com/questions/71087088/npm-run-coverage-fails-with-require-internalmodulestat-is-not-a-function

Totally random but it worked now.

huangapple
  • 本文由 发表于 2023年5月6日 15:29:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76187654.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定