[node-red-dashboard/ui_button] SyntaxError: Unexpected token

Hi, is something wrong with latest version of dashboard?

24 Sep 08:37:25 - [info] Node-RED version: v0.20.7
24 Sep 08:37:25 - [info] Node.js  version: v8.1.3
24 Sep 08:37:25 - [info] Linux 4.19.66-v7+ arm LE
...
24 Sep 08:40:48 - [info] Installing module: node-red-dashboard, version: 2.16.3
24 Sep 08:41:05 - [info] Installed module: node-red-dashboard
24 Sep 08:41:06 - [info] Added node types:
24 Sep 08:41:06 - [info]  - node-red-dashboard:ui_base
24 Sep 08:41:06 - [info]  - node-red-dashboard:ui_button : SyntaxError: Unexpected token ...

Above after 1st load, and then, when I stop and start the server:

24 Sep 08:44:45 - [info] Node-RED version: v0.20.7
24 Sep 08:44:45 - [info] Node.js  version: v8.1.3
24 Sep 08:44:45 - [info] Linux 4.19.66-v7+ arm LE
24 Sep 08:44:46 - [info] Loading palette nodes
24 Sep 08:44:51 - [warn] ------------------------------------------------------
24 Sep 08:44:51 - [warn] [node-red-dashboard/ui_button] SyntaxError: Unexpected token ...
24 Sep 08:44:51 - [warn] ------------------------------------------------------

Which then lets the server fall over:

24 Sep 08:46:50 - TypeError: Cannot read property 'emit' of undefined
    at /data/node_modules/node-red-dashboard/ui.js:406:11
    at _combinedTickCallback (internal/process/next_tick.js:95:7)
    at process._tickCallback (internal/process/next_tick.js:161:9)
npm info lifecycle node-red-docker@1.0.0~start: Failed to exec start script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@1.0.0 start: `node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-red-docker@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

And then, the server falls over every time after that. And that is without. single flow element created....

... I am suffering from the same issue. You are not alone if this might comfort you.

24.09.19 17:24:53 (+0200)  node-red  Welcome to Node-RED
24.09.19 17:24:53 (+0200)  node-red  ===================
24.09.19 17:24:53 (+0200)  node-red  
24.09.19 17:24:53 (+0200)  node-red  24 Sep 15:24:53 - [info] Node-RED version: v0.20.7
24.09.19 17:24:53 (+0200)  node-red  24 Sep 15:24:53 - [info] Node.js  version: v8.1.3
24.09.19 17:24:53 (+0200)  node-red  24 Sep 15:24:53 - [info] Linux 4.14.98 arm LE
24.09.19 17:24:54 (+0200)  node-red  24 Sep 15:24:54 - [info] Loading palette nodes
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [warn] ------------------------------------------------------
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [warn] [node-red-dashboard/ui_button] SyntaxError: Unexpected token ...
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [warn] ------------------------------------------------------
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [info] Settings file  : /data/settings.js
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [info] Context store  : 'default' [module=memory]
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [info] User directory : /data
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [warn] No active project : using default flows file
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [info] Flows file     : /data/flows.json
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [info] Creating new flow file
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [warn] 
24.09.19 17:24:58 (+0200)  node-red  
24.09.19 17:24:58 (+0200)  node-red  ---------------------------------------------------------------------
24.09.19 17:24:58 (+0200)  node-red  Your flow credentials file is encrypted using a system-generated key.
24.09.19 17:24:58 (+0200)  node-red  
24.09.19 17:24:58 (+0200)  node-red  If the system-generated key is lost for any reason, your credentials
24.09.19 17:24:58 (+0200)  node-red  file will not be recoverable, you will have to delete it and re-enter
24.09.19 17:24:58 (+0200)  node-red  your credentials.
24.09.19 17:24:58 (+0200)  node-red  
24.09.19 17:24:58 (+0200)  node-red  You should set your own key using the 'credentialSecret' option in
24.09.19 17:24:58 (+0200)  node-red  your settings file. Node-RED will then re-encrypt your credentials
24.09.19 17:24:58 (+0200)  node-red  file using your chosen key the next time you deploy a change.
24.09.19 17:24:58 (+0200)  node-red  ---------------------------------------------------------------------
24.09.19 17:24:58 (+0200)  node-red  
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [info] Starting flows
24.09.19 17:24:58 (+0200)  node-red  24 Sep 15:24:58 - [info] Started flows
24.09.19 17:24:59 (+0200)  node-red  24 Sep 15:24:59 - [info] Server now running at http://127.0.0.1:80/

I think your node.js version is too old. The latest version of Node 8 is 8.16.1.

Ahh, thanks @knolleary, this must then be caused by the latest RPi docker image, I had to downgrade to nodered/node-red-docker:0.20.7-rpi , 0.20.8-rpi does not work.

For the same reason I have also downgraded to docker version 0.20.7-rpi-v8.

Here below my docker file.

#see https://hub.docker.com/r/nodered/node-red-docker
FROM nodered/node-red-docker:0.20.7-rpi-v8

# installing editor nano 
USER root
RUN apt-get update && apt-get install nano

# Following command installs node-red-admin which is needed if you want to create a hashed password 
# for the node-red editor.  For that run command "node-red-admin hash-pw" in a terminal window
# for the node-red service in the BalenaCloud dashboard.
RUN npm install -g --unsafe-perm node-red-admin

# see https://stackoverflow.com/questions/53026557/error-listen-eacces-0-0-0-080-when-deploying-docker-image-nodered-node-red-doc
RUN sudo setcap 'cap_net_bind_service=+ep'  $(eval readlink -f `which node`)
USER node-red

RUN npm install node-red-contrib-resinio
RUN npm install node-red-dashboard
RUN npm install node-red-contrib-credentials

COPY ./settings.js /data/settings.js
#COPY ./flows.json  /data/flows.json
1 Like

Thank you, switched over to

Raymondmm’s docker image, all problems solved.

https://hub.docker.com/r/raymondmm/node-red

FYI - We're in the process of merging the great work Raymond has done into the official images (with his help)

2 Likes

Indeed by upgrading the node.js version from v8.1.3 to v8.16.1 I got rid of the error [node-red-dashboard/ui_button] SyntaxError: Unexpected token ...

I have added the following command to my balena Dockerfile to upgrade it to version v8.16.1

RUN npm cache clean -f ; npm install -g n ; n 8.16.1

As evidence that the change fixed it, see the log file here below.

24.09.19 22:49:55 (+0200)  node-red  24 Sep 20:49:55 - [info] 
24.09.19 22:49:55 (+0200)  node-red  
24.09.19 22:49:55 (+0200)  node-red  Welcome to Node-RED
24.09.19 22:49:55 (+0200)  node-red  ===================
24.09.19 22:49:55 (+0200)  node-red  
24.09.19 22:49:55 (+0200)  node-red  24 Sep 20:49:55 - [info] Node-RED version: v0.20.7
24.09.19 22:49:55 (+0200)  node-red  24 Sep 20:49:55 - [info] Node.js  version: v8.16.1
24.09.19 22:49:55 (+0200)  node-red  24 Sep 20:49:55 - [info] Linux 4.14.98 arm LE
24.09.19 22:49:56 (+0200)  node-red  24 Sep 20:49:56 - [info] Loading palette nodes
24.09.19 22:50:01 (+0200)  node-red  24 Sep 20:50:01 - [info] Dashboard version 2.16.3 started at /ui
24.09.19 22:50:02 (+0200)  node-red  24 Sep 20:50:02 - [info] Settings file  : /data/settings.js
24.09.19 22:50:02 (+0200)  node-red  24 Sep 20:50:02 - [info] Context store  : 'default' [module=memory]
24.09.19 22:50:02 (+0200)  node-red  24 Sep 20:50:02 - [info] User directory : /data
24.09.19 22:50:02 (+0200)  node-red  24 Sep 20:50:02 - [warn] No active project : using default flows file
24.09.19 22:50:02 (+0200)  node-red  24 Sep 20:50:02 - [info] Flows file     : /data/flows.json
24.09.19 22:50:02 (+0200)  node-red  24 Sep 20:50:02 - [info] Creating new flow file
24.09.19 22:50:02 (+0200)  node-red  24 Sep 20:50:02 - [info] Starting flows

FYI my complete docker file.

#see https://hub.docker.com/r/nodered/node-red-docker
FROM nodered/node-red-docker:0.20.7-rpi-v8

# installing editor nano 
USER root
RUN apt-get update && apt-get install nano

# upgraded node.js to current latest version 8.16.1
# apparently the version in the docker image is pretty old.
RUN npm cache clean -f ; npm install -g n ; n 8.16.1

# Following command installs node-red-admin which is needed if you want to create a hashed password 
# for the node-red editor.  For that run command "node-red-admin hash-pw" in a terminal window
# for the node-red service in the BalenaCloud dashboard.
RUN npm install -g --unsafe-perm node-red-admin

# see https://stackoverflow.com/questions/53026557/error-listen-eacces-0-0-0-080-when-deploying-docker-image-nodered-node-red-doc
RUN sudo setcap 'cap_net_bind_service=+ep'  $(eval readlink -f `which node`)
USER node-red

RUN npm install node-red-contrib-resinio
RUN npm install node-red-dashboard
RUN npm install node-red-contrib-credentials

COPY ./settings.js /data/settings.js
1 Like