【问题标题】:Typescript Deployment issues (no issues local deployment)Typescript 部署问题(本地部署没有问题)
【发布时间】:2021-11-17 09:11:02
【问题描述】:

我正在开发一个托管在 AWS 上的 typescript 网站,该网站通过 Github 存储库进行放大,我在部署该网站时遇到了间歇性问题。通常情况下,网站可以正确构建并且没有重大问题/障碍,但偶尔,网站会在构建的前端部分失败。

它给出的主要错误是:

2021-09-24T02:11:16.620Z [WARNING]: There might be a problem with the project dependency tree.
                                    It is likely not a bug in Create React App, but something you need to fix locally.
                                    The react-scripts package provided by Create React App requires a dependency:
                                    "babel-loader": "8.1.0"
Don't try to install it manually: your package manager does it automatically.
                                    However, a different version of babel-loader was detected higher up in the tree:
                                    /codebuild/output/--/--/--/node_modules/babel-loader (version: 8.2.2)
                                    Manually installing incompatible versions is known to cause hard-to-debug issues.

它继续详细说明为了解决这个问题而采取的一些步骤,我尝试了很多次都没有成功(删除锁、节点模块文件夹、从 package.json 中删除 babel-loader)我还尝试添加 SKIP_PREFLIGHT_CHECK =true 到 .env 文件。这样做解决了那个错误,但又引发了另一个错误,如下所述:

2021-09-24T02:07:11.394Z [INFO]: ./node_modules/@usedapp/core/node_modules/ethers/lib.esm/utils.js 30:0-32:73
                                 Attempted import error: 'TransactionTypes' is not exported from '@ethersproject/transactions'.

再次,编译在我的个人机器上工作,并且仅在尝试在 Amazon Amplify 上构建相同的 Github 存储库时出现(间歇性)问题

如果您有任何想法或建议,请告诉我!

-剪辑

【问题讨论】:

    标签: reactjs typescript deployment node-modules aws-amplify


    【解决方案1】:

    看起来你正在使用的库没有导出你需要的东西,如果你控制了你应该导出的库。 确保在 tsconfig.json 中设置 "isolatedModules": true

    【讨论】:

    • 嗨,纳撒尼尔,感谢您的回复。我正在使用的库是导入的,并且损坏的构建在该特定库的使用方面根本没有任何区别。此外,tsconfig.json 中的“isolatedModules”确实设置为 true
    猜你喜欢
    • 1970-01-01
    • 2020-07-13
    • 2020-06-23
    • 2014-07-07
    • 2014-11-07
    • 2011-11-25
    • 2014-05-30
    相关资源
    最近更新 更多