我试图将React项目部署到Heroku,但是当将文件推送到Heroku主分支时,构建失败,因为“未找到模块:错误:无法解析“/tmp/build_0de13186/src”“中的”-/firebase-config“。
如何重新添加/恢复此丢失的模块?它是本地丢失还是远程丢失?
我的react项目由一个服务器和一个客户端组成,它们都位于同一个根文件夹中,服务器和客户端都有自己的package.json,并安装了firebase。
remote: -----> Build
remote: Running build
remote:
remote: > fullstackapp@0.1.0 build
remote: > react-scripts build
remote:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: Module not found: Error: Can't resolve '-/firebase-config' in '/tmp/build_0de13186/src'
remote:
remote:
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: b577f7b18ab92dd19ec0a6e615586f97af15d9f6
remote: !
remote: ! We have detected that you have triggered a build from source code with version b577f7b18ab92dd19ec0a6e615586f97af15d9f6
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to fullstackapp-portfolio.
remote:
To https://git.heroku.com/fullstackapp-portfolio.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/fullstackapp-portfolio.git'
1条答案
按热度按时间axr492tv1#
包含客户端文件的前端文件夹与server.js一起位于根Map中
Firebase-config.js我位于前端文件夹根目录内。firebase-config.js的导入失败发生在前端文件夹--〉应用程序内。