3

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 } } 

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

EDIT: 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) 
7
  • 1
    You are confusing the protractor config with the tsconfig. Protractor config file should have an absolute URL for the browser to hit, but the tsconfig baseUrl/paths are for module resolutions gist.github.com/vladima/725949fd9464e6a94771#pathMappings Commented Jul 22, 2016 at 14:45
  • The first comment is your answer. I don't know why it's not posted as the answer. Commented Jul 22, 2016 at 15:01
  • What do you mean? He was talking about the protractor configuration's "baseUrl", not tsconfig's "baseUrl" and "paths" options. Commented Jul 22, 2016 at 15:06
  • 1
    tsconfig does does not have an option for "baseUrl" and "paths." Those are protractor configuration options. That is why your TypeScript compiler is failing to compile. And that is what the first comment was explaining. Commented Jul 22, 2016 at 15:09
  • 1
    Gotcha, I take my last comment back. However, that's a TypeScript 2 feature, no? Are you using TypeScript 2 compiler? Commented Jul 22, 2016 at 15:14

1 Answer 1

6

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

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.