NGRP / node-red-contrib-viseo

Node-RED nodes OpenSourced by VISEO Technologies
Apache License 2.0
227 stars 83 forks source link

On Windows 10, install instructions FAIL to allow framework to run #58

Open TotallyInformation opened 6 years ago

TotallyInformation commented 6 years ago

I've followed the install instructions in the WIKI but when I come to run, it fails.

Windows 10, Node.js v6.11.3

Truth is that your Windows start.bat file is completely wrong!

Here is one that is at least close to working:

SET NODE_TLS_REJECT_UNAUTHORIZED=0
SET PORT=1881
SET NODE_ENV=dev
@REM SET NODE_ENV=production

SET CUR_DIR=%CD%
SET SOURCE=%~dp0

SET FRAMEWORK_ROOT=%SOURCE%
SET BOT_ROOT=%CUR_DIR%
SET CONFIG_PATH=%CUR_DIR%\conf\config.js
SET APP=viseobot

pm2 start %SOURCE%\node_modules\node-red\red.js --name %APP% -- -s %SOURCE%\conf\node-red-config.js

However, there are other issues as well.

Your node-red-config.js file is full of assumptions. Firstly you haven't used path.join for local paths:

userDir: process.env.BOT_ROOT + '/data/',

should be:

userDir: path.join(process.env.BOT_ROOT, 'data'),

and so on.

Secondly, you are assuming that the environment variables contain safe data which is a terrible mistake for anyone wanting to use this in production.

Thirdly, I am getting a warning that a node cannot be loaded:

9 Sep 16:36:16 - [warn] [msbot-attachment] SyntaxError: Unexpected token function

Not sure what the impact of that is.

JpEncausse commented 6 years ago

We've made some improvement to work with Docker, so the documentation is not up to date. There is new ENV cariable.

For windows user I will also release a zip with all the files.

BTW, you will need to upgrade to Node v8 (up from v6)

The msbot-attachment warn is bug, that will be fixed but it do not prevent from working

TotallyInformation commented 6 years ago

So it doesn't work on v6 - it would be helpful to update the package.json - if you add an engine directive, installers should get a warning.

Shame it doesn't work with the current LTS version of Node.

JpEncausse commented 6 years ago

helpful to update the package.json

Yes good idea !

Shame it doesn't work with the current LTS version of Node.

No it's a little framework, Node version is moving fast, we use the latest version (and features atm)