Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

pm2-service-install throws exception #2

Closed
arieljannai opened this issue Dec 24, 2015 · 9 comments
Closed

pm2-service-install throws exception #2

arieljannai opened this issue Dec 24, 2015 · 9 comments
Assignees

Comments

@arieljannai
Copy link

Hi,

I get an exception when trying to install with pm2-service-install.
The exception is:

C:\Users\ariel.j\AppData\Roaming\npm\node_modules\pm2-windows-service\bin\pm2-se
const pm2ws = require('../src/index');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Maybe it has something to do with my node version?

@jon-hall
Copy link
Owner

You're probably right, judging by the error, this library uses some ES6 features which require node 4+ (it might work on 0.12.x if you add the --harmony flag when you run pm2-service-install, but I haven't confirmed this).

If you can check your node version and either update or try using --harmony, if that doesn't solve the issue just let me know and I'll take a look into it.

@darkvas
Copy link

darkvas commented Dec 24, 2015

I tried run pm2-service-install --harmony, and received this error again.
node version 0.12.7, Windows Server 2012 R2

@jon-hall
Copy link
Owner

Yeah, wasn't sure about the adding --harmony flag suggestion, on reflection - even if it worked - it would almost certainly have installed a non-working service 😖.

This library does only support node 4+ currently (this is in the package.json but I'll update the README as it should make this explicit), so if you can update I'd recommend you do, especially as node 4 now has an LTS release.

If anyone is actually unable to update, please post up here and I'll take a crack at making the package 0.12.x compatible, though I'm not inclined to unless anyone is really stuck on node 0.12.x for some reason.

@arieljannai
Copy link
Author

Thanks for your reply!
Unfortunately I'm not able to update since the projects we work with are still depend on v0.12.
I'll try using some of the programs that allow running multiple node versions on the same machine, so the service could use node 4/5 and my projects will use v0.12

@jon-hall
Copy link
Owner

Had a bit more of a look into this and it seems the service already gets run with the --harmony flag, which means it should be pretty simple to get this working on node v0.12.x.

I just pushed a commit which should give 0.12.x compatibility, if you want to install master with npm install jon-hall/pm2-windows-service -g and give it a try. This appears to work fine for me using node 0.12.7 via nvm-windows.

@jon-hall jon-hall self-assigned this Dec 27, 2015
@jon-hall
Copy link
Owner

jon-hall commented Jul 3, 2016

Closing this out as there's been no activity in a while, if anyone does get issues using older versions of node, comment here and I can reopen.

@krupalbhardiya
Copy link

krupalbhardiya commented Jan 22, 2020

Annotation 2020-01-22 115252

@jon-hall

I have multiple node version environment running in the system.
from the image you can see that i have three Node.Js LTE versions installed.
Currently running version is v10.15.0 (64 bit)

Current Environment:
Windows 10 Pro 64bit (1909)

Globally installed Modules version:
+-- npm@6.4.1
+-- pm2@4.2.3
`-- pm2-windows-service@0.2.1

From Command line with Administrator Priviledges, I am executing the command to install pm2 service. After executing the command, process asks whether to "Perform Environment Setup (recommended) ?". I am selecting "yes". But after that nothing happens. Process stays idle from that point onwards and there is no activity or changes happening in services.

@bsjaffer
Copy link

bsjaffer commented Nov 9, 2020

@krupalbhardiya Did you got any solution for the same, I am also facing the same issue

@krupalbhardiya
Copy link

krupalbhardiya commented Nov 13, 2020

@bsjaffer yes i found it in an earlier issue.

check out the solution from earlier answer by Schokojim

#56 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants