【问题标题】:TS Project - Cannot find moduleTS 项目 - 找不到模块
【发布时间】:2016-01-17 01:59:43
【问题描述】:

我有一个带有 tsconfig.json 的打字稿项目,并且所有节点模块导入都有错误 找不到模块。我错过了什么?相应的模块安装在node_modules文件夹中,执行tsc正常

导入示例:import {Component, Inject} from 'angular2/core';

tsconfig.json:

{ "compilerOptions": { "target": "es5", "module": "commonjs", "experimentalDecorators": true, "experimentalAsyncFunctions": true, "emitDecoratorMetadata": true, "noImplicitAny": false, "moduleResolution": "node" }, "exclude": [ "node_modules", "dist" ] }

【问题讨论】:

    标签: visual-studio-code


    【解决方案1】:

    查看您的文件夹结构有助于验证您的设置是否正确。

    您似乎缺少的是 angular2 的 tsd 文件。

    npm install -g tsd tsd query angular2 --action install

    查看VS Code docs 了解更多信息。

    【讨论】:

      【解决方案2】:

      我可以通过从 tsconfig.json 中删除以下行来修复它。 tsc CLI 提示我这是一个问题。

      "experimentalAsyncFunctions": true,

      【讨论】:

        猜你喜欢
        • 2019-10-05
        • 2017-04-16
        • 1970-01-01
        • 2018-04-19
        • 1970-01-01
        • 2017-07-02
        • 2020-07-22
        • 2020-12-23
        • 2022-07-25
        相关资源
        最近更新 更多