问题
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)
回答1:
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.
来源:https://stackoverflow.com/questions/38529236/protractor-configuration-error-w-typescript-angular-2