When learning typescript, you want to execute the TS file. First install the TS package, then use the TSC command to execute it, compile it into a JS file, and use node xxx.js to execute it. However, this is troublesome. Later, you want to use TS node to directly execute it and simplify the steps. An error is reported:
It is found that the corresponding package needs to be installed to compile:
Solution:
npm install -D tslib @types/node
Read More:
- [Solved] node.js Upload Files Error: Multipart: boundary not found multer
- [Weex]Error in creating project NPM: unable to load file D:\program files\nodejs\node_ global\ weex.ps1 Because scripts are not allowed to run on this system.
- How to Solve pinia Error in ts File
- Ts-node Error: return new TSError(diagnosticText, diagnosticCodes);
- [Solved] error C:\Users\HP\Desktop\VueProject\vue_cli\node_modules\node-sass: Command failed.Exit code: 1
- [Solved] Error: ENOENT: no such file or directory, scandir ‘..\node_modules\node-sass\vendor‘
- TypeScript error TS2345: Argument of type ‘String ‘is not assignable to parameter of type ‘string’
- [Solved] error TS1086: An accessor cannot be declared in an ambient context
- [Solved] Error: Incorrect arguments to mysqld_stmt_execute
- How to Solve Vue project Startup Error (Node Upgrade issue)
- [Solved] ERROR in ./src/main.ts Module not found: Error: Can‘t resolve ‘xxx‘
- How to Solve Node start error listen eacces 0.0.0.0:810
- node.js yarn Error: SyntaxError: Unexpected string [How to Solve]
- The solution that needs alert to execute after using ajax
- Failed to execute ‘setRequestHeader’ on ‘XMLHttpRequest’: String contains non ISO-8859-1 code point.
- [Solved] Failed to execute ‘getRangeAt‘ on ‘Selection‘: 0 is not a valid index.“
- [Solved] Node sass version 7.0.0 is incompatible with ^ 4.0.0 | ^ 5.0.0 | ^ 6.0.0
- [Solved] Uncaught DOMException: Failed to execute ‘readAsDataURL‘ on ‘FileReader‘: The object is already busy
- Node.js Error: Cannot find module express [How to Solve]
- Vue installs sass loader directly, and node sass reports an error