带TypeScript + Angular 2的量角器配置错误 [英] Protractor configuration error w/ TypeScript + Angular 2

查看:46
本文介绍了带TypeScript + Angular 2的量角器配置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使Protractor在我的项目中运行时遇到问题.我的tsconfig.json文件出现问题:

I'm having problems getting Protractor to run in my project. It's having problems with my tsconfig.json file:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "baseUrl": "./src",
    "paths": {
      "components": ["app/components"],
      "core": ["app/core"],
      "data": ["app/data"],
      "pages": ["app/pages"],
      "schemas": ["app/schemas"],
      "utility": ["app/utility"]
    }
  },
  "exclude": [
    "node_modules"
  ],
  "awesomeTypescriptLoaderOptions": {
    "forkChecker": true,
    "useWebpackText": true
  },
  "compileOnSave": false,
  "buildOnSave": false,
  "atom": { "rewriteTsconfig": false }
}

它在"baseUrl"和"paths"选项上特别失败.如果我将其取出,它将运行完美.有什么想法吗?

It's specifically failing on "baseUrl" and "paths" options. If I take those out, it runs perfectly. Any ideas?

我目前正在使用Protractor 3.2.2,我们更新到4.0只是为了获得此堆栈跟踪:

I'm currently using Protractor 3.2.2 and we updated to 4.0 just to get this stack trace:

TSError: ⨯ Unable to compile TypeScript
Unknown compiler option 'baseUrl'. (5023)
Unknown compiler option 'paths'. (5023)
    at Object.register (/Users/Dan/git/LifeSiteAngular2/node_modules/ts-node/src/index.ts:185:11)
    at Object.<anonymous> (/Users/Dan/git/LifeSiteAngular2/node_modules/ts-node/register.js:1:15)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/Dan/git/LifeSiteAngular2/config/protractor.conf.js:5:1)
    at Module._compile (module.js:413:34)

推荐答案

问题是较旧的打字稿版本与tsconfig.json中的baseUrl和path选项不兼容.

The issue is an older version of typescript not being compatible with the baseUrl and paths options inside tsconfig.json.

此问题已通过将量角器更新为4.0.0版并将打字稿更新为2.0.0版来解决.

This is fixed by updating protractor to version 4.0.0, and typescript to version 2.0.0.

这篇关于带TypeScript + Angular 2的量角器配置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆