Questions tagged [ts-node]

Short for TypeScript Node. Built to execute TypeScript for Node.js. You might also include TypeScript and/or Node.js - tags if you use this tag.

References

487 questions
0
votes
1 answer

Call a static method on a class from a list of paths inside a node script?

Question: How can I take a list of paths to files Array: // ['apps/morningharwood/src/app/app.component.ts', // 'apps/morningharwood/src/app/app-shell/app-shell.component.ts'] And for each path, call a static method on them…
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
0
votes
1 answer

ts-node runs tests on OS X but not in Ubuntu

I'm having a strange issue with TS-Error being thrown when I run my tests in Linux but running fine and passing in OS X. The project is written in Typescript and tested with Mocha (using ts-node). When I run the tests on OS X I don't experience any…
0
votes
1 answer

Typescript: Syntax error. Unexpected token

I am trying to launch .ts file as console app. After converting .ts files to .js (through tsc) there was no error, but I can't launch .ts file with ts-node because of issue: "SyntaxError: Unexpected token ..." My tsconfig.json file…
seri
  • 3
  • 1
  • 2
0
votes
1 answer

Mocha not understanding TypeScript "implements" keyword, giving SyntaxError: "... Unexpected token, expected {"

I simply want to be able to run Mocha tests in TypeScript with ES6 (I used npm to install mocha, ts-node, and babel-core packages). My mocha command and the resulting error, followed by relevant code snippets below. Note that ES6 doesn't seem to be…
user3773048
  • 5,839
  • 4
  • 18
  • 22
0
votes
1 answer

How do I run a test file using ts-node?

Being fairly new to node and ts-node, I'm struggling to figure out how to run tests from this open source project -- https://github.com/pocesar/node-stratum (which are .ts files). I installed both "typescript" and "ts-node"…
satish
  • 703
  • 5
  • 23
  • 52
0
votes
0 answers

Nodemon with ts-node express server: app crashed

I'm trying to build an express server with an angular 5 client. I'm using "ts-node" and "nodemon" and "ng build --watch" all together in one "dev" script so they can all automatically compile together. Every other time the app changes, nodemon says…
Buzzyboy
  • 221
  • 2
  • 12
0
votes
3 answers

How to output a consoles log to another file as regular text

I'm trying to print the result of my console.log to another .txt file, how would I make this happen? this is what my console.log looks like this: https://i.stack.imgur.com/pYY00.jpg I'm wanting this printed as regular text to an output file e.g…
Aidan el Goste
  • 383
  • 1
  • 3
  • 23
0
votes
4 answers

How to conditionally append a name to a string?

I'm trying to put a company name in front of a card number, this code here is what i'm attempting to make it print the name in front. The problem i'm having here is that each company has rules - conditions, i'm struggling to make these rules into…
Aidan el Goste
  • 383
  • 1
  • 3
  • 23
0
votes
1 answer

Cannot run e2e tests with protractor: cannot resolve path?

I can’t seem to run my e2e tests with protractor. Before I begin here is some background info: Node: 7.7.4 NPM: 4.1.2. Angular: 4.1.0 Protractor: 5.1.2 After I ran npm install protractor, I installed and updated web driver and got an update for…
jrDeveloper
  • 167
  • 2
  • 10
0
votes
1 answer

PM2 and tsnode : pass "--fast" option

I'm using pm2 (2.5.0) and ts-node (3.1.0) I saw in ts-node's documentation that you can pass a "--fast" option, so that compilation is faster. I'm using pm2 to start my .ts app. How can I tell pm2 to pass that 'fast' option to ts-node? Thanks
David
  • 33,444
  • 11
  • 80
  • 118
0
votes
0 answers

E/launcher - Error: TSError: Unable to Compile Typescript

Hey guys, I am facing following problem: My Project is built on Angular4 with typescript, e2e testing with protractor & karma. But since a few days I keep getting following error: File 'D:/myproject/node_modules/protractor/package.json' has…
ndeufemia
  • 474
  • 5
  • 13
0
votes
1 answer

Trouble getting Mocha, node.js and WebStorm to work with each other

I have been following the instructions to install Mocha with WebStorm found here: https://www.jetbrains.com/help/webstorm/2017.1/testing-javascript-with-mocha.html#d194239e92 I have set the configurations to run files that match the pattern:…
Marcus Ruddick
  • 9,795
  • 7
  • 28
  • 43
-1
votes
1 answer

VS Code reports invalid errors in ts-node shell scripts

I read this article on how to run a typescript file on the command line, and it appears to be working, but VS Code is reporting invalid errors: You can see from the terminal (bottom half of the picture) that this file runs without issue. According…
-1
votes
1 answer

why this error occurs ? Error: Cannot find module 'arg' while running ts-node filename.ts

$ ts-node basic.ts image I tried npm i -g arg but still error occurs I tried to run a typescript file using ts-node in ubuntu 22.04 and expecting the output of typescript file
-1
votes
1 answer

VSCode show error with interface extended

I have a error with VSCode. It show me an error when I use a new method for "string": When I run with npx ts-node, there is not error. How fix VsCode? I look for VSCode not to show those errors. Here the code: //types.d.ts interface String { …
1 2 3
32
33