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

Node-red/Raspberry pi zero crashes #44

Closed
iotlearner0level opened this issue Apr 12, 2018 · 35 comments
Closed

Node-red/Raspberry pi zero crashes #44

iotlearner0level opened this issue Apr 12, 2018 · 35 comments
Assignees
Labels

Comments

@iotlearner0level
Copy link

On installing this node, node-red just crashes on startup with the message Illegal Instruction.

if i delete this node node-red starts as normal. i think zero is arm6. Is this node for armv7?

I've installed from pallette manager as well as from command line in ~/.node-red$ npm install node-red-node-xyz and the same problem

@johanstokking johanstokking self-assigned this Apr 12, 2018
@johanstokking
Copy link
Contributor

Thanks for reporting. Can you post the full stack trace?

@iotlearner0level
Copy link
Author

please guide how can i do that?

@johanstokking
Copy link
Contributor

Can you copy paste what Node-RED outputs on start?

@iotlearner0level
Copy link
Author

`pi@zeropi:~ $ node-red
13 Apr 15:21:17 - [info]

Welcome to Node-RED

13 Apr 15:21:17 - [info] Node-RED version: v0.18.4
13 Apr 15:21:17 - [info] Node.js version: v8.11.1
13 Apr 15:21:17 - [info] Linux 4.9.80+ arm LE
13 Apr 15:21:37 - [info] Loading palette nodes
Illegal instruction
`

pi@zeropi:~/.node-red/node_modules $ rm node-red-contrib-ttn/ -rf pi@zeropi:~/.node-red/node_modules $ node-red

`13 Apr 15:27:52 - [info]

Welcome to Node-RED

13 Apr 15:27:52 - [info] Node-RED version: v0.18.4
13 Apr 15:27:52 - [info] Node.js version: v8.11.1
13 Apr 15:27:52 - [info] Linux 4.9.80+ arm LE
13 Apr 15:27:58 - [info] Loading palette nodes
13 Apr 15:28:23 - [info] Dashboard version 2.8.2 started at /ui
13 Apr 15:28:30 - [warn] ------------------------------------------------------
13 Apr 15:28:30 - [warn] [node-red-node-sqlite/sqlite] Error: Cannot find module '/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v57-linux-arm/node_sqlite3.node' (line:4)
13 Apr 15:28:30 - [warn] ------------------------------------------------------
13 Apr 15:28:30 - [info] Settings file : /home/pi/.node-red/settings.js
13 Apr 15:28:30 - [info] User directory : /home/pi/.node-red
13 Apr 15:28:30 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
13 Apr 15:28:30 - [info] Flows file : /home/pi/.node-red/flows_zeropi.json
13 Apr 15:28:30 - [info] Server now running at http://127.0.0.1:1880/
13 Apr 15:28:31 - [info] Waiting for missing types to be registered:
13 Apr 15:28:31 - [info] - sqlitedb

`

@johanstokking
Copy link
Contributor

That's weird. How did you install Node.js? Can you try upgrading Node.js?

Also, can you check if the examples in https://github.com/thethingsnetwork/node-app-sdk do work? Let's see if we can isolate this issue from Node-RED, which is harder to debug.

@iotlearner0level
Copy link
Author

$sudo apt-get install nodejs

Following the instructions here: https://www.thethingsnetwork.org/docs/applications/nodejs/quick-start.html

i get:
pi@zeropi:~/app $ node .
Illegal instruction

@iotlearner0level
Copy link
Author

iotlearner0level commented Apr 17, 2018

based on suggestions, i installed from https://nodejs.org/dist/v9.11.1/node-v9.11.1-linux-armv6l.tar.xz installed to /opt and changed the symlink form /usr/bin to v9.11 and ttn seems to work without any problem!!
pi@zeropi:~/.node-red $ node -v
v9.11.1
then i ran npm install from ~/.node-red
then the same problem of illegal instruction.
sorry for wasting your time..but strange that only ttn used to crash node-red and nothing else

@johanstokking
Copy link
Contributor

That is weird indeed. Can you confirm that the Node version that Node-RED reports is now v9.11.1?

@iotlearner0level
Copy link
Author

iotlearner0level commented Apr 18, 2018

I deleted :~/.node-red/node_modules/node-red-contrib-ttn and all the reference to ttn in package.json as well as in the package-lock.json. restarted node-red, and installed from pallette...node-red dies with illegal instruction!! Looks like i won't be able to use ttn in node-red on the pi zero...and by the way, another lora related node called lora-packet-decoder works ok.
and node-red reports v9.11.1

pi@zeropi:~/.node-red $ node-red-pi
pi@zeropi:~/.node-red $ node -v
v9.11.1
pi@zeropi:~/.node-red $ npm -v
1.4.21
pi@zeropi:~/.node-red $ node-red-pi
18 Apr 15:05:34 - [info]

Welcome to Node-RED
===================

18 Apr 15:05:34 - [info] Node-RED version: v0.18.4
18 Apr 15:05:34 - [info] Node.js  version: v9.11.1
18 Apr 15:05:34 - [info] Linux 4.9.80+ arm LE
18 Apr 15:05:40 - [info] Loading palette nodes
18 Apr 15:06:11 - [info] Dashboard version 2.8.2 started at /ui
18 Apr 15:06:24 - [warn] ------------------------------------------------------
18 Apr 15:06:24 - [warn] [node-red-node-serialport/serialport] Error: The module '/home/pi/.node-red/noderialport.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. This version of Node.js requires
NODE_MODULE_VERSION 59. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
18 Apr 15:06:24 - [warn] [node-red-contrib-ovia-os/os] 'NetworkIntf' already registered by module node-re
18 Apr 15:06:24 - [warn] ------------------------------------------------------
18 Apr 15:06:24 - [info] Settings file  : /home/pi/.node-red/settings.js
18 Apr 15:06:24 - [info] User directory : /home/pi/.node-red
18 Apr 15:06:24 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
18 Apr 15:06:24 - [info] Flows file     : /home/pi/.node-red/flows_zeropi.json
18 Apr 15:06:24 - [info] Starting flows
18 Apr 15:06:25 - [info] Started flows
18 Apr 15:06:25 - [info] Server now running at http://127.0.0.1:1880/
18 Apr 15:07:28 - [info] Installing module: node-red-contrib-ttn, version: 2.0.4
18 Apr 15:09:00 - [info] Installed module: node-red-contrib-ttn
Illegal instruction
pi@zeropi:~/.node-red $

@iotlearner0level
Copy link
Author

After a little more effort, there is some problem with ttn-app. See the following:

pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ node ttn-app.js
Illegal instruction

But if i run node with other nodes, no such error message..

pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ cd ..
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn $ ls
docker-entrypoint.sh  docs      lib      package.json  ttn-app       ttn-event   yarn.lock
Dockerfile            examples  LICENSE  README.md     ttn-downlink  ttn-uplink
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn $ cd ttn-event/
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-event $ ls
icons  ttn-event.html  ttn-event.js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-event $ node ttn-event.js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-event $

@iotlearner0level
Copy link
Author

If i delete ttn-app.js, node-red works without any trouble. Not sure what could be the reason:

pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn $ ls
docker-entrypoint.sh  docs      lib      package.json  ttn-app       ttn-event   yarn.lock
Dockerfile            examples  LICENSE  README.md     ttn-downlink  ttn-uplink
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn $ cd ttn-app/
ls
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ ls
ttn-app.html  ttn-app.js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ mv ttn-app.js ttn-old-js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ node ttn-old-js
Illegal instruction
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ leafpad ttn-old-js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ node ttn-old-js
Illegal instruction
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ node ttn-app.js
Illegal instruction
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ node-red
18 Apr 15:30:17 - [info]

Welcome to Node-RED
===================

18 Apr 15:30:17 - [info] Node-RED version: v0.18.4
18 Apr 15:30:17 - [info] Node.js  version: v9.11.1
18 Apr 15:30:17 - [info] Linux 4.9.80+ arm LE
18 Apr 15:30:23 - [info] Loading palette nodes
Illegal instruction
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ ls
ttn-app.html  ttn-app.js  ttn-old-js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ ls -l
total 12
-rw-r--r-- 1 pi pi 1775 Feb 13 19:36 ttn-app.html
-rw-r--r-- 1 pi pi  972 Apr 18 15:29 ttn-app.js
-rw-r--r-- 1 pi pi  974 Apr 18 15:16 ttn-old-js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ ls -l ../ttn-downlink/
total 12
drwxr-xr-x 2 pi pi 4096 Feb 13 19:36 icons
-rw-r--r-- 1 pi pi 3467 Feb 13 19:36 ttn-downlink.html
-rw-r--r-- 1 pi pi  966 Feb 13 19:36 ttn-downlink.js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ rm ttn-app.js
pi@zeropi:~/.node-red/node_modules/node-red-contrib-ttn/ttn-app $ node-red
18 Apr 15:31:48 - [info]

Welcome to Node-RED
===================

18 Apr 15:31:48 - [info] Node-RED version: v0.18.4
18 Apr 15:31:48 - [info] Node.js  version: v9.11.1
18 Apr 15:31:48 - [info] Linux 4.9.80+ arm LE
18 Apr 15:31:53 - [info] Loading palette nodes
18 Apr 15:32:20 - [info] Dashboard version 2.8.2 started at /ui
18 Apr 15:32:34 - [warn] ------------------------------------------------------
18 Apr 15:32:34 - [warn] [node-red-node-serialport/serialport] Error: The module '/home/pi/.node-red/node_modules/serialport/build/Release/serialport.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. This version of Node.js requires
NODE_MODULE_VERSION 59. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
18 Apr 15:32:34 - [warn] [node-red-contrib-ovia-os/os] 'NetworkIntf' already registered by module node-red-contrib-os
18 Apr 15:32:34 - [warn] [node-red-contrib-ttn/ttn-app] Error: Cannot find module '/home/pi/.node-red/node_modules/node-red-contrib-ttn/ttn-app/ttn-app.js'
18 Apr 15:32:34 - [warn] ------------------------------------------------------
18 Apr 15:32:34 - [info] Settings file  : /home/pi/.node-red/settings.js
18 Apr 15:32:34 - [info] User directory : /home/pi/.node-red
18 Apr 15:32:34 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
18 Apr 15:32:34 - [info] Flows file     : /home/pi/.node-red/flows_zeropi.json
18 Apr 15:32:35 - [info] Server now running at http://127.0.0.1:1880/
18 Apr 15:32:35 - [info] Starting flows
18 Apr 15:32:35 - [info] Started flows


@johanstokking
Copy link
Contributor

It seems that the node in ttn-event and ttn-app are instantiated differently; the former one has a more graceful early exit, which may not crash Node-RED but still does not work.

The error Illegal instruction doesn't give any pointers, so best is to isolate the issue.

Can you try with the node-app-sdk examples, regardless of Node-RED?

@iotlearner0level
Copy link
Author

iotlearner0level commented Apr 21, 2018

 node -v
v9.11.1

pi@zeropi:~ $ rm -rf app
pi@zeropi:~ $ mkdir app
pi@zeropi:~ $ cd app
pi@zeropi:~/app $ npm install --save ttn
npm WARN engine jsonwebtoken@7.4.3: wanted: {"npm":">=1.4.28","node":">=0.12"} (                         current: {"node":"4.8.2","npm":"1.4.21"})
npm WARN engine joi@6.10.1: wanted: {"node":">=0.10.40","npm":">=2.0.0"} (curren                         t: {"node":"4.8.2","npm":"1.4.21"})
npm WARN package.json bcrypt-pbkdf@1.0.1 No repository field.
npm WARN package.json json-schema@0.2.3 No license field.
npm WARN package.json punycode@1.4.1 punycode is also the name of a node core mo                         dule.
npm WARN package.json string_decoder@1.0.3 string_decoder is also the name of a                          node core module.
|
> grpc@1.10.1 install /home/pi/app/node_modules/ttn/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

[grpc] Success: "/home/pi/app/node_modules/ttn/node_modules/grpc/src/node/extens                         ion_binary/node-v59-linux-arm-glibc/grpc_node.node" is installed via remote
ttn@2.3.1 node_modules/ttn
├── google-protobuf@3.5.0
├── debug@2.6.9 (ms@2.0.0)
├── source-map-support@0.4.18 (source-map@0.5.7)
├── node-fetch@1.7.3 (is-stream@1.1.0, encoding@0.1.12)
├── mqtt@2.17.0 (inherits@2.0.3, reinterval@1.1.0, xtend@4.0.1, minimist@1.2.0,                          split2@2.2.0, commist@1.0.0, concat-stream@1.6.2, end-of-stream@1.4.1, mqtt-pack                         et@5.5.0, pump@3.0.0, readable-stream@2.3.6, websocket-stream@5.1.2, help-me@1.1                         .0)
├── jsonwebtoken@7.4.3 (lodash.once@4.1.1, ms@2.1.1, xtend@4.0.1, jws@3.1.4, joi                         @6.10.1)
├── ttnapi@2.0.0
├── babel-runtime@6.26.0 (regenerator-runtime@0.11.1, core-js@2.5.5)
└── grpc@1.10.1 (nan@2.10.0, protobufjs@5.0.2, lodash@4.17.5)
pi@zeropi:~/app $ ls
node_modules
pi@zeropi:~/app $ cd node_modules/
pi@zeropi:~/app/node_modules $ ls
ttn
pi@zeropi:~/app/node_modules $ cd ttn/
pi@zeropi:~/app/node_modules/ttn $ ls
dist  DOCUMENTATION.md  documentation.yml  LICENSE  Makefile  node_modules  package.json  README.md
pi@zeropi:~/app/node_modules/ttn $ cd node_modules/
pi@zeropi:~/app/node_modules/ttn/node_modules $ ls
babel-runtime  debug  google-protobuf  grpc  jsonwebtoken  mqtt  node-fetch  source-map-support  ttnapi
pi@zeropi:~/app/node_modules/ttn/node_modules $ cd mqtt/
pi@zeropi:~/app/node_modules/ttn/node_modules/mqtt $ ls
bin              dist  examples  LICENSE.md  node_modules  README.md  types
CONTRIBUTING.md  doc   lib       mqtt.js     package.json  test
pi@zeropi:~/app/node_modules/ttn/node_modules/mqtt $ node mqtt.js help
MQTT.js command line interface, available commands are:

  * publish     publish a message to the broker
  * subscribe   subscribe for updates from the broker
  * version     the current MQTT.js version
  * help        help about commands

Launch 'mqtt help [command]' to know more about the commands.
pi@zeropi:~/app/node_modules/ttn/node_modules/mqtt $ cd ..
pi@zeropi:~/app/node_modules/ttn/node_modules $ ls
babel-runtime  debug  google-protobuf  grpc  jsonwebtoken  mqtt  node-fetch  source-map-support  ttnapi
pi@zeropi:~/app/node_modules/ttn/node_modules $ cd ttnapi/
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi $ ls
api.pb.go     api.proto  gateway        LICENSE    networkserver  python     trace
api_pb.js     broker     gen-python.sh  logfields  package.json   README.md  utils
api_pb.rb     c          handler        Makefile   php            reference  validation.go
api.pb.swift  discovery  java           monitor    protocol       router
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi $ node api_pb.js
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi $ cd monitor/
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi/monitor $ ls
monitorclient            Monitor.md     monitor_pb.rb     monitor.server.pb.swift
monitor.client.pb.swift  monitor.pb.go  monitor.pb.swift  monitor_services_pb.rb
monitor_grpc_pb.js       monitor_pb.js  monitor.proto
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi/monitor $ node monitor_pb.js
/home/pi/app/node_modules/ttn/node_modules/google-protobuf/google-protobuf.js:154
goog.object.extend=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<goog.object.PROTOTYPE_FIELDS_.length;f++)c=goog.object.PROTOTYPE_FIELDS_[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};
                                                                                                                                                                                                                                       ^

TypeError: Cannot convert undefined or null to object
    at hasOwnProperty (<anonymous>)
    at Object.goog.object.extend (/home/pi/app/node_modules/ttn/node_modules/google-protobuf/google-protobuf.js:154:232)
    at Object.<anonymous> (/home/pi/app/node_modules/ttn/node_modules/ttnapi/monitor/monitor_pb.js:20:13)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi/monitor $ cd ..

pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi $ cd broker/
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi/broker $ ls
brokerclient            Broker.md     broker.pb.swift         getters.go                  random_test.go
broker.client.pb.swift  broker.pb.go  broker.proto            message_marshaling.go       util.go
broker_grpc_pb.js       broker_pb.js  broker.server.pb.swift  message_marshaling_test.go  validation.go
BrokerManager.md        broker_pb.rb  broker_services_pb.rb   random.go
pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi/broker $ node broker_pb.js

these seem to work ok, without causing illegal instruction.

Meanwhile, if i go to the dist folder,

pi@zeropi:~/app/node_modules/ttn/node_modules/ttnapi/broker $ cd ../..
pi@zeropi:~/app/node_modules/ttn/node_modules $ ls
babel-runtime  debug  google-protobuf  grpc  jsonwebtoken  mqtt  node-fetch  source-map-support  ttnapi
pi@zeropi:~/app/node_modules/ttn/node_modules $ cd ..
pi@zeropi:~/app/node_modules/ttn $ ls
dist  DOCUMENTATION.md  documentation.yml  LICENSE  Makefile  node_modules  package.json  README.md
pi@zeropi:~/app/node_modules/ttn $ cd dist/
pi@zeropi:~/app/node_modules/ttn/dist $ ls
account  applications  data  discovery  handler  index.js  utils
pi@zeropi:~/app/node_modules/ttn/dist $ ls applications/
applications.js  index.js  normalize.js  types.js
pi@zeropi:~/app/node_modules/ttn/dist $ node applications/index.js
Illegal instruction
pi@zeropi:~/app/node_modules/ttn/dist $ node applications/normalize.js
pi@zeropi:~/app/node_modules/ttn/dist $ node applications/types.js
pi@zeropi:~/app/node_modules/ttn/dist $ node applications/applications.js
Illegal instruction
pi@zeropi:~/app/node_modules/ttn/dist $
pi@zeropi:~/app/node_modules/ttn/dist $ node handler/
handler.js  index.js
pi@zeropi:~/app/node_modules/ttn/dist $ node handler/handler.js
Illegal instruction
pi@zeropi:~/app/node_modules/ttn/dist $ node index.js
Illegal instruction


if you want me to check any specific node, please indicate because i don't have enough knowledge to mess around!

@johanstokking
Copy link
Contributor

Thanks. Can you git clone https://github.com/TheThingsNetwork/node-app-sdk.git and follow instructions on https://github.com/thethingsnetwork/node-app-sdk?

Specifically the sections Test, Quality, Build and Example.

It might be that the Build step produces different output for your processor architecture, so building it on your Pi Zero may make it work in the Example.

@iotlearner0level
Copy link
Author

iotlearner0level commented Apr 24, 2018

I am new to this nodejs environment and toolchain. so i might have missed some step. anyhow make test gives the following illegal instruction

pi@zeropi:~/test/node-app-sdk $ make test
node-app-sdk  testing 6 js files
 FAIL  src/data/data.test.js (22.066s)
  ● DataClient.on('error')

    Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

      at pTimeout (node_modules/jest-jasmine2/build/queueRunner.js:53:21)
      at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:523:19)
      at ontimeout (timers.js:466:11)
      at tryOnTimeout (timers.js:304:5)
      at Timer.listOnTimeout (timers.js:267:5)

  ● DataClient.on('error')

    expect.assertions(2)

    Expected two assertions to be called but only received zero assertion calls.

      at addAssertionErrors (node_modules/jest-jasmine2/build/setup-jest-globals.js:68:21)
          at <anonymous>

 PASS  src/utils/is-token.test.js
 PASS  src/data/topic.test.js

 RUNS  src/discovery/discovery.test.js
.make/js/quality.make:26: recipe for target 'js.test' failed
make: *** [js.test] Illegal instruction
pi@zeropi:~/test/node-app-sdk $




make typecheck says platform not supported for flow-bin/cli.js

pi@zeropi:~/test/node-app-sdk $ make typecheck
node-app-sdk  typechecking all files
/home/pi/test/node-app-sdk/node_modules/flow-bin/cli.js:20
  throw new Error('Platform not supported.');
  ^

Error: Platform not supported.
    at Object.<anonymous> (/home/pi/test/node-app-sdk/node_modules/flow-bin/cli.js:20:9)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
Makefile:35: recipe for target 'typecheck' failed
make: *** [typecheck] Error 1

make quality doesn't proceed because make typecheck fails:


pi@zeropi:~/test/node-app-sdk $ make quality
node-app-sdk  linting 33 js files
The react/jsx-space-before-closing rule is deprecated. Please use the react/jsx-tag-spacing rule with the "beforeSelfClosing" option instead.
node-app-sdk  typechecking all files
/home/pi/test/node-app-sdk/node_modules/flow-bin/cli.js:20
  throw new Error('Platform not supported.');
  ^

Error: Platform not supported.
    at Object.<anonymous> (/home/pi/test/node-app-sdk/node_modules/flow-bin/cli.js:20:9)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
Makefile:35: recipe for target 'typecheck' failed
make: *** [typecheck] Error 1
pi@zeropi:~/test/node-app-sdk $

On the contrary make build proceeds without any errors:



pi@zeropi:~/test/node-app-sdk $ make build
src/account/account.js -> dist/account/account.js
src/account/index.js -> dist/account/index.js
src/applications/applications.js -> dist/applications/applications.js
src/applications/index.js -> dist/applications/index.js
src/applications/normalize.js -> dist/applications/normalize.js
src/applications/types.js -> dist/applications/types.js
src/data/data.js -> dist/data/data.js
src/data/index.js -> dist/data/index.js
src/data/topic.js -> dist/data/topic.js
src/discovery/discovery.js -> dist/discovery/discovery.js
src/discovery/index.js -> dist/discovery/index.js
src/handler/handler.js -> dist/handler/handler.js
src/handler/index.js -> dist/handler/index.js
src/index.js -> dist/index.js
src/utils/debug.js -> dist/utils/debug.js
src/utils/index.js -> dist/utils/index.js
src/utils/is-token.js -> dist/utils/is-token.js
src/utils/key.js -> dist/utils/key.js
src/utils/wrap.js -> dist/utils/wrap.js



but little success if i go to the dist folder:


pi@zeropi:~/test/node-app-sdk $ cd dist/
pi@zeropi:~/test/node-app-sdk/dist $ ls
account  applications  data  discovery  handler  index.js  utils
pi@zeropi:~/test/node-app-sdk/dist $ cd applications/
pi@zeropi:~/test/node-app-sdk/dist/applications $ ls
applications.js  index.js  normalize.js  types.js
pi@zeropi:~/test/node-app-sdk/dist/applications $ node applications.js
Illegal instruction
pi@zeropi:~/test/node-app-sdk/dist/applications $

So looks like i'm stuck.

In addition to this, i've unrelated problem in TTN http integration, i've forwrded all the payload to google firebase via its REST API (starting from here: https://firebase.google.com/docs/reference/rest/database/ enabling anonymous access using POST method. i've tried both https as well as http). requests are delayed by upto 4-5 hours! i raised a question on ttn forums but there was no response...not sure what is the right place to go..

@johanstokking
Copy link
Contributor

Thanks. It may be a platform issue indeed with one of the dependencies, making the Pi Zero an unsupported platform for this library.

Can you verify and run the examples (so not dist)? See https://github.com/TheThingsNetwork/node-app-sdk/tree/master/examples

@iotlearner0level
Copy link
Author

iotlearner0level commented Apr 30, 2018

pi@zeropi:~ $ cd test/node-app-sdk/examples/
pi@zeropi:~/test/node-app-sdk/examples $ ls
account.js  application.js  data.js  discovery.js  es5
pi@zeropi:~/test/node-app-sdk/examples $ node application.js
/home/pi/test/node-app-sdk/examples/application.js:6
import { application as App, key } from "../src"
^^^^^^

SyntaxError: Unexpected token import
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (internal/modules/cjs/loader.js:618:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
pi@zeropi:~/test/node-app-sdk/examples $

here is what ../src looks like:

pi@zeropi:~/test/node-app-sdk/examples $ ls ../src/
account  applications  data  discovery  handler  index.js  utils

From the es5 directory:

pi@zeropi:~/test/node-app-sdk/examples $ cd es5/
pi@zeropi:~/test/node-app-sdk/examples/es5 $ ls
application.js  data.js
pi@zeropi:~/test/node-app-sdk/examples/es5 $ node application.js
Illegal instruction
pi@zeropi:~/test/node-app-sdk/examples/es5 $
pi@zeropi:~/test/node-app-sdk/examples/es5 $ node data.js
Illegal instruction

Testing more from examples:

pi@zeropi:~/test/node-app-sdk/examples $ node account.js
/home/pi/test/node-app-sdk/examples/account.js:6
import { account } from "../src"
^^^^^^

SyntaxError: Unexpected token import
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (internal/modules/cjs/loader.js:618:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
pi@zeropi:~/test/node-app-sdk/examples $

Not sure why is there an error for import

@johanstokking
Copy link
Contributor

It seems some dependencies were outdated. I upgraded them, see the feature/update-deps branch (https://github.com/TheThingsNetwork/node-app-sdk/tree/feature/update-deps)

Can you check again? Best is to remove the node_modules and try install everything with yarn.

Finally, please let me know your node -v output.

@iotlearner0level
Copy link
Author

Its compiling. looks like it will take a few more days...

pi@zeropi:~/test/node-app-sdk $ yarn install
yarn install v1.6.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.2: The platform "linux" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "eslint-config-ttn > eslint-plugin-react@6.10.3" has incorrect peer dependency "eslint@^2.0.0 || ^3.0.0".
[4/4] Building fresh packages...
[1/1] ⠐ grpc
[-/1] ⠈ waiting...
[-/1] ⠈ waiting...
[-/1] ⠈ waiting...
[-/1] ⠈ waiting...
[1

@iotlearner0level
Copy link
Author

Inspite of trying several times, it gives me out of memory error.

@johanstokking
Copy link
Contributor

johanstokking commented May 10, 2018

OK. I'm afraid we have to keep this one open.

@iotlearner0level
Copy link
Author

i will try again after a month or so. i'm a bit busy with my "real life" maybe i will try with some swap memory on the pi zero which only has like 512mb ram. to save sdcard corruption i turned off swap. if i use node directly with any of the .js it gives me some import error

@GryKyo
Copy link

GryKyo commented Feb 4, 2019

OK. I'm afraid we have to keep this one open.

@johanstokking : Did you ever reach a conclusion with this issue? Unsupported platform armV6l? I have put mosquitto and Node-Red on a Pi Zero W which already runs a TTN packet forwarder (Rak radio) for a student needs to do some LoRaWAN project work. Everything is stable until I use the palette manager to install this node. Node-red crashes and node hogs almost all cpu and memory. Has this been a recurring issue? Will this ever work on Pi Zero W? Thanks GryKyo

@johanstokking
Copy link
Contributor

@GryKyo I'm quite sure the issue is related to the compilation of a gRPC dependency. Can you try running npm install -g ttn from command line and copy the output?

@ruifcsilva
Copy link

I thought I would share this as the exact same thing just happened with me on booth Raspberry Pi Zero W and Raspberry Pi 3 B+
if of any help, see my pots on Node-Red Forum: https://discourse.nodered.org/t/code-killed-status-4-ill/9627?u=ruifcsilva

@rbm78bln
Copy link

Yes, I can also confirm this on RPi0W, RPi3B+, and RPi1B+ happing.
Any news on this?

@dusnoki
Copy link

dusnoki commented May 30, 2019

I can confirm as well, as soon as I install node-red-contrib-ttn on the raspberry pi zero w either from the palette manager or via npm i from the console, node-red just doesn't want to start. I have to remove it with
rm -rf node_modules/node-red-contrib-ttn sudo service nodered restart
and it comes back alive.

May 30 16:14:07 raspberrypi systemd[1]: Started Node-RED graphical event wiring tool. May 30 16:14:20 raspberrypi Node-RED[2913]: 30 May 16:14:20 - [info] May 30 16:14:20 raspberrypi Node-RED[2913]: Welcome to Node-RED May 30 16:14:20 raspberrypi Node-RED[2913]: =================== May 30 16:14:20 raspberrypi Node-RED[2913]: 30 May 16:14:20 - [info] Node-RED version: v0.20.3 May 30 16:14:20 raspberrypi Node-RED[2913]: 30 May 16:14:20 - [info] Node.js version: v10.15.3 May 30 16:14:20 raspberrypi Node-RED[2913]: 30 May 16:14:20 - [info] Linux 4.14.98+ arm LE May 30 16:14:26 raspberrypi Node-RED[2913]: 30 May 16:14:26 - [info] Loading palette nodes May 30 16:14:51 raspberrypi systemd[1]: nodered.service: Main process exited, code=killed, status=4/ILL May 30 16:14:52 raspberrypi systemd[1]: nodered.service: Unit entered failed state. May 30 16:14:52 raspberrypi systemd[1]: nodered.service: Failed with result 'signal'. May 30 16:14:52 raspberrypi systemd[1]: nodered.service: Service hold-off time over, scheduling restart. May 30 16:14:52 raspberrypi systemd[1]: Stopped Node-RED graphical event wiring tool.

@GryKyo
Copy link

GryKyo commented May 31, 2019

I managed to knock out Node-Red on a PiZero based TTN gateway once again by installing this, so yes I can confirm that this is still an issue.

G

@johanstokking
Copy link
Contributor

Please provide context; Node version, Node-RED version, error messages, output from installation, etc.

@dusnoki
Copy link

dusnoki commented May 31, 2019

Device: Raspberry Pi Zero W Official
Linux raspberrypi 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l
Node version: v10.15.3
Node-Red: v0.20.3

Install with ssh cd ~/.node-red && npm install node-red-contrib-ttn
output:
`
pi@raspberrypi:~/.node-red $ npm install node-red-contrib-ttn
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

  • node-red-contrib-ttn@2.0.5
    added 1 package from 1 contributor and audited 2752 packages in 271.506s
    found 49 vulnerabilities (35 moderate, 14 high)
    run `npm audit fix` to fix them, or `npm audi\tfor details

output from journalctl -u nodered.service --since today -f

`May 31 22:18:25 raspberrypi systemd[1]: Started Node-RED graphical event wiring tool.

May 31 22:18:35 raspberrypi Node-RED[13356]: 31 May 22:18:35 - [info]

May 31 22:18:35 raspberrypi Node-RED[13356]: Welcome to Node-RED

May 31 22:18:35 raspberrypi Node-RED[13356]: ===================

May 31 22:18:35 raspberrypi Node-RED[13356]: 31 May 22:18:35 - [info] Node-RED version: v0.20.3

May 31 22:18:35 raspberrypi Node-RED[13356]: 31 May 22:18:35 - [info] Node.js version: v10.15.3

May 31 22:18:35 raspberrypi Node-RED[13356]: 31 May 22:18:35 - [info] Linux 4.14.98+ arm LE

May 31 22:18:40 raspberrypi Node-RED[13356]: 31 May 22:18:40 - [info] Loading palette nodes

May 31 22:19:06 raspberrypi systemd[1]: nodered.service: Main process exited, code=killed, status=4/ILL

May 31 22:19:07 raspberrypi systemd[1]: nodered.service: Unit entered failed state.

May 31 22:19:07 raspberrypi systemd[1]: nodered.service: Failed with result 'signal'.

May 31 22:19:07 raspberrypi systemd[1]: nodered.service: Service hold-off time over, scheduling restart.

May 31 22:19:07 raspberrypi systemd[1]: Stopped Node-RED graphical event wiring tool.
`

@dusnoki
Copy link

dusnoki commented Jun 8, 2019

@johanstokking Did you get a chance to check out this bug? I would really like to have ttn working on my node red on the raspberry pi zero W. If you need any help from me let me know what I can do, test or fix. Cheers

@dusnoki
Copy link

dusnoki commented Jun 10, 2019

I think I have found the culprit... https://github.com/grpc/grpc
Specifically this issue
grpc/grpc#13258
mapbox/node-pre-gyp#348
Going to try and do a workaround

@dusnoki
Copy link

dusnoki commented Jun 10, 2019

I found a workaround,
Install the package from either the palete manager in node red, or through npm i,
cd ~/.node-red
npm rebuild --build-from-source=grpc
!Warning, it will take a long time, don't know exactly how long cause I just left the terminal open.
and then do:
sudo service nodered restart

And you should be all set to go.

@johanstokking
Copy link
Contributor

Great, thanks so much @dusnoki

Should we update the README?

@johanstokking
Copy link
Contributor

RPi support is now deprecated. We'll add guides for V3 to work with builtin Node-RED nodes (i.e. the MQTT input and output nodes)

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

No branches or pull requests

6 participants