When running a ts file using ts-node in the terminal, I get an error.
bug to reproduce
Solution
// Install the runtime library of the TypeScript helper, including all TypeScript helper functions npm install -D tslib @types/node
reason
console is not part of the EcmaScript standard. The console in the DOM is in the browser environment and belongs to the browser BOM API. The console in Node is an API in Node.js, which is defined by nodejs itself. Although the two have the same function, they are not the same thing.
Read More:
- How to Fix Error Cannot find command ‘git‘ – do you have ‘git‘ installed and in your PATH?
- [Solved] Typescript installation TS node execution error
- hint: Updates were rejected because the remote contains work that you do To XXX
- [Solved] Failed to find glog – Could not find glog include directory, set…
- Angular6 rxjs start error in node_modules/rxjs/internal/types.d.ts(81,44): error TS1005: ‘;’ expected.
- [Solved] Vue gaiters console.log error: Unexpected console statement (no-console)
- [Solved] TS Error: Could not find a declaration file for module
- Vue+TS main.ts error: unused expression, expected an assignment or function call
- [Solved] npm Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
- [Solved] Use the truss console to connect to the public blockchain network error: mnemonic invalid or undefined
- SAP RETAIL Automatic replenishment WRP1R transaction code error: Forecast values for determining target stock do not exist –
- Gem5 Compiler error: error: -Werror=……no option [How to Solve]
- error: library dfftpack has Fortran sources but no Fortran compiler found
- How to Solve Vscode terminal error (ts -v)
- Tensorflow C++:You must define TF_LIB_GTL_ALIGNED_CHAR_ARRAY for your compiler
- Proguard Packaging Error: You have to specify ‘-keep‘ options if you want to write out kept elements with ‘-print
- Introduce wangeditor5 to run an error: You may need an appropriate loader to handle this file type (es6 compatibility issue)
- [Solved] Electron Error: Error: Electron failed to install correctly, please delete node_modules/electron and try
- [Solved] PSPICE Error: ERROR(ORPSIM-16276): Can‘t find library