I am facing the problem:
My Project is built on Angular4 with typescript, e2e testing with protractor & karma.
Travis-ci has this error:
[03:34:54] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript Cannot find type definition file for 'jasmine'. (2688) Cannot find type definition file for 'node'. (2688) e2e/app.e2e-spec.ts (1,32): Cannot find module './app.po'. (2307) e2e/app.e2e-spec.ts (4,1): Cannot find name 'describe'. (2304) e2e/app.e2e-spec.ts (7,3): Cannot find name 'beforeEach'. (2304) e2e/app.e2e-spec.ts (11,3): Cannot find name 'it'. (2304) e2e/app.e2e-spec.ts (13,5): Cannot find name 'expect'. (2304) The command "ng e2e" exited with 4.
My tsconfig.json:
{ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "baseUrl": ".", "paths": { "*": ["./node_modules/*", "*"] }, "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "types": [ "node", "jasmine" ], "typeRoots": [ "./node_modules/@types" ], "lib": [ "es2016", "dom" ] } }
My tsconfig.spec.json:
{ "compilerOptions": { "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": [ "es2016", "dom" ], "outDir": "../out-tsc/spec", "module": "commonjs", "target": "es5", "baseUrl": "", "types": [ "jasmine", "node" ], "typeRoots": [ "../node_modules/@types" ] }, "files": [ "test.ts" ], "include": [ "**/*.spec.ts" ] }
Node v6.10.3
npm v3.10.10
Please help me.
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal. To do this, run npm install -g typescript . This will install the latest version (currently 4.7).
ts-node is a TypeScript execution engine and REPL for Node. js. It JIT transforms TypeScript into JavaScript, enabling you to directly execute TypeScript on Node. js without precompiling. This is accomplished by hooking node's module loading APIs, enabling it to be used seamlessly alongside other Node.
I had met same issue. First I remove ts-node
and typescript
from package.json
. then,
npm install ts-node --save-dev npm install typescript -g npm install typescript --save-dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With