-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Windows - pm2 install typescript #2675
Comments
From the pm2 log: 2017-01-31 16:29:05: Error: spawn C:\Users\Me\AppData\Roaming\npm\node_modules\pm2\node_modules.bin\ts-node ENOENT |
@kevincollins7 Could you retest with this patch ? (you can use |
@vmarchaud Just tested. Still not working. The console shows the error: npm ls -g --depth=0 shows the following: npm ERR! extraneous: ts-node@2.0.0 C:\Users\Me\AppData\Roaming\npm\node_modules\pm2\node_modules\ts-node npm ERR! extraneous: typescript@2.1.5 C:\Users\Me\AppData\Roaming\npm\node_modules\pm2\node_modules\typescript And finally pm2.log: |
Could you paste me the ecosystem or CLI command that you are using ? |
Is the ts-node available in the path: |
When you do
Can you tell me the exact path of the ts-node binary? btw to resolve the path: |
It appears to me that the global install "npm install ts-node -g" is placing the the ts-node binary in the npm root. But it appears that PM2 is attempting to find a ts-node binary created after running "pm2 install typescript" correct? |
Also if I change that code you are referencing in the Common.js file to: if (app.exec_interpreter == 'ts-node') { The error in the console goes away. However the app still errors out and in the .pm2 log I see: 2017-02-02 10:11:49: Error: spawn C:\Users\Kevin\AppData\Roaming\npm\node_modules\pm2\ts-node ENOENT |
Could you retry again please ? Do not forget to |
@vmarchaud No problem. Ran the install and update as you said. Same errors however I noticed that "pm2 install typescript" now installed a typescript and ts-node directory directly in the project. However there is not a .bin folder where it is looking for one. pm2.log |
Last hope with 2e6ed64 if its not working you will be on your own to fix this problem, we didn't have any windows to test the issue. |
@vmarchaud Thanks but still not working! I will keep looking into it to see if I can assist. Just so I'm completely understanding though - the goal is for "pm2 start app.ts" to execute a binary ts-node file correct? Was the ts-node interpreter ever tested on Windows before? I have used ts-node by itself and have had no issues so I really think it's just a matter of getting pm2 to find what it's looking for in a Windows environment. |
When you use You just need to play with the path used to make it works. |
@vmarchaud I think I'm on to something. It appears that when "pm2 install typescript" is executed it places a 'ts-node' AND 'ts-node.cmd' file in the pm2 root. I changed the Common.js file like so: pm2/lib/Common.js line 368 That started throwing a bunch of these errors: A quick search on Google and I ended up back in the pm2 github for a similar problem where the reporter had said they removed 'ipc' from the ForkMode.js file. https://github.com/Unitech/pm2/issues/2037 pm2/lib/God/ForkMode.js line 98
I tried that and it worked! It does open a separate "Node" window which is kind of strange but from what I can tell everything seems to be working. I'm not familiar enough with the inner-workings of pm2 to know how removing 'ipc' from the ForkMode.js file will effect everything else but was hoping that this would help narrow down the issue for you? |
IPC is used to communicate with your process to get metrics from it so it isnt possible to remove it. |
Just wanted to say I'm experiencing this issue as well. Would love to see it resolved as it might make me unable to use PM2 at all. I know it sounds kind of lame, but you can always set up a preview copy of Windows 10 in a VM. (trust me, I'm a linux guy, I know how silly the licensing is!) |
@vmarchaud your workaround is not working at all and the issue is still persisting. I'm experiencing exactly the same behaviour as @kevincollins7 |
We don't have any Windows PC so feel free to make a PR to fix the issue if anyone find a solution :) |
Then I guess that's not relevant anymore... https://keymetrics.io/2016/08/24/pm2-v2-released/#windowssupport |
@ezamelczyk Indeed its not relevant anymore, when i arrived at keymetrics i was working on Windows but one month after i switched to Linux because it's too difficult to work on windows. |
any progress? same error here with the latest version typescipt pm2 and ts-node. |
Hi, any chance to have it fixed? |
@kevincollins7 I believe this is caused by the fact that .bat/.cmd files are not executable by theirselves on Windows. See node doc https://nodejs.org/dist/latest-v9.x/docs/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows That say, you need pass a Lines 94 to 100 in a435f2f
'/c', command to args and make the cmd.exe as your command.
The same may apply to cluster mode too. |
Hi, any chance to have it fixed? |
I'm using Windows 10 and I'm not facing this issue, may you try removing ts-node from global and leave pm2 handle it? These were my steps to config my env:
And execute my config file...
{
"apps": [
{
"name": "lost-pets",
"script": "./src/bin/index.ts",
"watch": ["./src"],
"instances": 0,
"exec_mode": "cluster"
}
]
} |
@sant123 what if |
same problem in fork mode (windows 7) |
only cluster works for me also, problem is that if i run this command directly (while the service is cluster) |
I was able to repro the issue outside of pm2: PS > node -e "require('child_process').spawn('.\\ts-node', { stdio: 'inherit' })"
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn .\ts-node ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn .\\ts-node',
path: '.\\ts-node',
spawnargs: []
} And adding the PS > node -e "require('child_process').spawn('.\\ts-node', { stdio: 'inherit', shell: true })"
> // ts-node REPL I haven't had time to test inside of pm2, but taking a look at the code, a quick prototype can be done by adding that setting in the options passed to |
Happening on both Windows 10 and Windows 7.
I have done the following:
npm install pm2 -g
npm install ts-node -g
pm2 install typescript
When I run pm2 start app.ts I get the following:
Interpreter C:\User\Me\AppData\Roaming\npm\node_modules\pm2\node_modules.bin\ts-node does seem to be available
I checked out that directory and sure enough there is nothing named ts-node there. I had a friend on a Mac send me a screenshot of his .bin directory and could tell that there was a ts-node symlink pointed to the ../ts-node/dist/bin.js file. I attempted to created a symlink (in Windows) and that did not fix it.
Is the typescript interpreter working in Windows? Am I missing a step required for Windows? It worked very nicely on my friends Mac.
Global installs:
node@6.7.0
pm2@2.3.0
ts-node@2.0.0
typescript@2.1.5
The text was updated successfully, but these errors were encountered: