Unhandled rejection TSError: Unable to compile TypeScript
- khyati sehgal
- Aug 7, 2014
- 1 min read
Problem statement
DevTools listening on ws://127.0.0.1:52555/devtools/browser/24e3b3aa-b5fe-4940-bfb8-b1c18e4c60df Unhandled rejection TSError: Unable to compile TypeScript Cannot find type definition file for ‘chai’. (2688) Cannot find type definition file for ‘core-js’. (2688) Cannot find type definition file for ‘node’. (2688) Cannot find type definition file for ‘selenium-webdriver’. (2688) e2e\hooks\CommonHook.ts (7,16): Cannot find name ‘require’. (2304)
at getOutput (D:\workspace\GIT\QA-e2e\node_modules\ts-node\src\index.ts:316:17) at D:\workspace\GIT\QA-e2e\node_modules\ts-node\src\index.ts:347:18 at Object.compile (D:\workspace\GIT\QA-e2e\node_modules\ts-node\src\index.ts:474:19) at Module.m._compile (D:\workspace\GIT\QA-e2e\node_modules\ts-node\src\index.ts:410:44) at Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Object.require.extensions.(anonymous function) [as .ts] (D:\workspace\GIT\QA-e2e\node_modules\ts-node\src\index.ts:413:12) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at D:\workspace\GIT\QA-e2e\node_modules\cucumber\lib\cli\index.js:135:16 at Array.forEach (<anonymous>) at Cli.getSupportCodeLibrary (D:\workspace\GIT\QA-e2e\node_modules\cucumber\lib\cli\index.js:134:24) at Cli.<anonymous> (D:\workspace\GIT\QA-e2e\node_modules\cucumber\lib\cli\index.js:144:39) at Generator.next (<anonymous>)
Background:
Project specifications I am using :
Scripting language : TypeScript
Automation tool: Protractor
Framework type: BDD(Behaviour Driven ) using cucumber
Logging: Log4j
IDE- Vs code
Solution:
Remove ts-node and typescript from the package.json
Open terminal and try these commands
npm install ts-node --save-dev
(either update with the latest version of the ts-node or using ts-node@2.1.2 specifying the version you want to update on)
npm install typescript -g npm install typescript --save-dev
(either update with the latest version of the ts-node or using typescript@2.3.4 specifying the version you want to update on).
Keep on trying different ways to solve a problem until you find the best one.
Comentarios