typescript - 错误TS5056 : Cannot write file because it would be would be overwritten

标签 typescript compiler-errors blockchain

问题:由于此错误,我无法在本地启动区块链-突然 pop 。恐怕由于项目原因,我将无法共享很多代码。

背景:昨天早晨出现错误时,没有特别的更改。当我开始工作时,我只是尝试启动本地区块链,这使此错误出现:

error TS5056: Cannot write file '/dist/src/datasources/db.datasource.d.ts' because it would be overwritten by multiple input files.

我已经查看了先前打开的问题,建议在tsconfig.json中将allowJs设置为false,以及排除一些建议的路径,但是没有任何解决方案对我有帮助。拆除所有容器也是没有用的。

结果:
预期结果只是在执行特定脚本时简单地启动本地区块链,而目前尚未发生。

最佳答案

有两种解决方法

  • tsconfig.json文件中
    compilerOptions.declaration = false
    
  • 更改目录中的文件名
    例如:
    我你有他文件:
    a.ts
    a.json
    编译器将尝试创建(如果tsconfig.json中为declaration = true)
    a.ts文件的a.d.ts

    a.json文件
  • 的a.d.ts

    所以这里有问题。
    只需将json的名称更改为ajson.json(通过示例)即可解决问题。

    关于typescript - 错误TS5056 : Cannot write file because it would be would be overwritten,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58816736/

    相关文章:

    typescript - 并行运行一组 TaskEithers,但如果 1 个或多个任务失败则继续

    reactjs - 使用 Standardjs no-unused-vars

    R:wilcoxon 检验错误:分组因子必须恰好有 2 个水平

    testing - Hyperledger Fabric 测试网络中 channel 创建失败

    blockchain - 访问以太坊 Dapp

    angularjs - 如何为基于 Typescript 的 AngularJS 项目配置 SonarQube?

    angular - 类型错误 : Cannot read property 'flags' of undefined

    java - 莫名其妙的 "reference to println is ambiguous"编译错误

    c++ - C++ 多线程 : detach non-class type error

    rust - 契约(Contract)错误,消息 : method is not found