New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use TypeScript #2742
Comments
Because you need to install the |
As i described above i did install typescript with |
Are you sure that your app is working outside PM2, from your second screen we can see an error : |
Seems like ts-node cant find typescript. Not sure why TypeScript compiler is running anyway, but it cant find the definition files. And as i described above i was not able to install them by |
Because they aren't installed at the same place, there is a custom logic for transpiler, is |
I don't know i tried reinstalling everything several times. Can someone reproduce? |
This could be a TypeScript or npm issue: TypeScript requires alot of devDependencies e.g. the needed @types/node but none of them gets installed neither global or in pm2. I tried global node-ts and tsc and both had the same error. I downgraded to nodejs 6.10.0 and it worked. Still the error persists for pm2. |
Could you list me exactly what need to be installed (the minimum) to run a typescript file ? |
typescript:
ts-node:
|
Yes it is i checked everything alot of times. It has TypeScript dependency which has @types dependencies which seem not to be installed. Thats why it cant find node functions like require. I opened an issue here: |
I feel like npm is not installing ANY devDependencies. That would explain everything. Not sure if this is a global OS configuration or maybe new node 7 default. Can't find alot of informations tho. Cumbersome workaround: Go into |
If so pm2 should beneath typescript and ts-node install @types/node |
Any solution to this? |
Our team would like to minimize the number of steps needed to deploy a typescript application. Initially, we thought specifying the script would be enough. We've also tried using ts-node as the interpreter. We've found either approach does not work on Windows using version 2.7.1. It sounds like others are experiencing the same issues. Happy to provide additional details if needed.
|
I was facing exact same error. Problem was confusion between global pm2 with local pm2 installed in node_modules of my project. So I had to do Also that involves using ./node_modules/.bin/pm2 start src/server.ts --watch in your start script in package.json. |
Close this one cause duplicate of :#3312 |
Text from log file: App [index:0] online PM2 works as expected with pure js projects, but does not work with typescript. I have tried to install globally and locally typescript and node-ts and other. It just does not work. |
|
@himself65 I've tried it |
@SerhiiBilyk |
@himself65 thank you. I think problem exists because I'm using "scripts": {
"start": "cross-env NODE_ENV=local ts-node -r tsconfig-paths/register index.ts",
"start:dev": "cross-env NODE_ENV=dev ts-node -r tsconfig-paths/register index.ts",
"start:prod": "cross-env NODE_ENV=prod ts-node index.ts",
"test": "jest --detectOpenHandles controllers/",
"prettier": "prettier --write **/*.ts"
}, Still have next error: [PM2] Spawning PM2 daemon with pm2_home=C:\Users\sbilyk.pm2 |
This works for me: |
I've had no luck with any of the solutions mentioned above. Perhaps this newer issue is why we are seeing this issue again: #4142 |
It's very simple guys. Just use
|
Expected behaviour
pm2 start x.ts
should work. (Maybe TypeScript should be installed on default so everything works out of the box)Actual behaviour
I was not able to start a ts file. js works fine.
Both ts-node and index have status "errored"
pm2 list:
I did
pm2 install typescript
andpm2 install node-ts
Here is the log:
When i try:
pm2 install @types/node
it says:Software versions used
PM2 Log output
The text was updated successfully, but these errors were encountered: