打字稿找不到模块量角器

马辛

我正在将e2e测试集成到我的项目中。该项目使用Typescript(2.6.1)。

我刚刚安装了量角器(5.2.0),但是无论我做什么,Typescript都无法从量角器模块导入任何内容。

我的tsconfig看起来像这样:

{
    "compilerOptions": {
        "target": "es5",
        "module": "amd"
    },
    "exclude": [
        "./spec",
        "./node_modules",
        "./bower_components"
    ]
}

我非常简单的试用测试如下所示:

import { browser } from "protractor";

describe("test should run", () => {
    it("should navigate to the page", () => {

    });
});

我收到以下错误: TypeScript error: usermanagement/ts/controllers/RolesController.e2e.ts(1,25): error TS2307: Cannot find module 'protractor'.

查看我node_modules文件夹中的Protractor安装,我确实找到了对键入文件和实际键入本身的引用。但是,Typescript根本不会“看到”它们。有趣的是,Typescript在node_modules/@types文件夹中查找类型没有问题

有人知道我在做什么错吗?

巴沙尔

在您的tsconfig中添加:

"module": "commonjs" 

更多

这是我在这里提到的推荐配置https://basarat.gitbooks.io/typescript/content/docs/quick/nodejs.html

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章