英文:
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
Totally random but it worked now.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论