coussej / node-opcua-logger

An OPCUA Client for logging data to InfluxDB! 🔌 🏭
https://www.factry.io
MIT License
179 stars 63 forks source link

cannot start the Win-64 service #47

Closed jasonye87 closed 4 years ago

jasonye87 commented 4 years ago

Hello Sir,

I tried to run the Win-64 .exe service and it throws out an error pointing to node-opcua-logger\node-modules\toml\lib\parser.js:3833 as shown in the capture. image

Could you help check the error and share the solution?

Thanks, Jason

coussej commented 4 years ago

Passing the config file with a flag won't work, if you want to use a custom location you should set it in the Environment (see also https://superuser.com/questions/79612/setting-and-getting-windows-environment-variables-from-the-command-prompt)

However, config.toml is the default location for the config file, and from the syntax error it looks like it's not formatted correctly. The error specifies it found a {, did you perhaps use JSON instead of TOML?

Can you share the contents of the file here?

jasonye87 commented 4 years ago

Thanks for the reply, Jeroen. After changing the config.toml file along with the sample file, now the application works well.

Just curious about how to set and use config.json file instead?

Regards, Jason


发件人: Jeroen Coussement notifications@github.com 发送时间: 2020年5月27日 16:49 收件人: coussej/node-opcua-logger node-opcua-logger@noreply.github.com 抄送: jasonye87 shenxi_ye@outlook.com; Author author@noreply.github.com 主题: Re: [coussej/node-opcua-logger] cannot start the Win-64 service (#47)

Passing the config file with a flag won't work, if you want to use a custom location you should set it in the Environment (see also https://superuser.com/questions/79612/setting-and-getting-windows-environment-variables-from-the-command-prompt)

However, config.toml is the default location for the config file, and from the syntax error it looks like it's not formatted correctly. The error specifies it found a {, did you perhaps use JSON instead of TOML?

Can you share the contents of the file here?

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/coussej/node-opcua-logger/issues/47#issuecomment-634521737, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQAC53CC362TYXEG766EETRTTH2XANCNFSM4NLWI5CA.

coussej commented 4 years ago

Hello,

the application determines the format based on the extension of the config file. You would set the necessary environment variable by running the following command:

set CONFIG_FILE=c:\path\to\config.json

and then in the same command line window you run the binary of the logger!

Usually, after testing config etc, you'd run the logger through a windows service. I usually suggest using nssm to do so. During the installation, you can also specify the environment variables for the service.

jasonye87 commented 4 years ago

Got it, thanks for the help!


发件人: Jeroen Coussement notifications@github.com 发送时间: 2020年5月27日 22:02 收件人: coussej/node-opcua-logger node-opcua-logger@noreply.github.com 抄送: jasonye87 shenxi_ye@outlook.com; Author author@noreply.github.com 主题: Re: [coussej/node-opcua-logger] cannot start the Win-64 service (#47)

Hello,

the application determines the format based on the extension of the config file. You would set the necessary environment variable by running the following command:

set CONFIG_FILE=c:\path\to\config.json

and then in the same command line window you run the binary of the logger!

Usually, after testing config etc, you'd run the logger through a windows service. I usually suggest using nssmhttps://nssm.cc/ to do so. During the installation, you can also specify the environment variables for the service.

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/coussej/node-opcua-logger/issues/47#issuecomment-634681698, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQAC5Y4M6BERVS7N6QU3SLRTUMN7ANCNFSM4NLWI5CA.

coussej commented 4 years ago

You're welcome!