rwblinn Posted July 16, 2016 at 10:19 AM Share Posted July 16, 2016 at 10:19 AM Hi, tried to run on a Raspberry Pi with Master Brick, Wifi Ext 2.0, Ambientlight the ExampleSimple.js. When running from the commandline $node ExampleSimple.js, received error: module.js:340 throw err; ^ Error: Cannot find module 'tinkerforge' The line in ExampleSimple.js not changed: var Tinkerforge = require('tinkerforge'); Installed the javaScript bindings using npm. Steps taken as user Pi with install message. cd /home/pi sudo npm -g install tinkerforge tinkerforge@2.0.9 /usr/lib/node_modules/tinkerforge When adding the full path to require('/usr/lib/node_modules/tinkerforge') it is working. How to setup without the need to add the full path in require. Any help appreciated. Quote Link to comment Share on other sites More sharing options...
Nic Posted July 19, 2016 at 08:53 AM Share Posted July 19, 2016 at 08:53 AM I had the same behaviour. After I installed the Tinkerforge modules globally, it was finally located in e.g. /usr/lib/node_modules. But its needed to add this location in NODE_PATH var to env in Linux like # export NODE_PATH=$NODE_PATH:/usr/lib/node_modules # env ... NODE_PATH=:/usr/lib/node_modules ... Ref.: http://www.tinkerunity.org/forum/index.php/topic,2216.msg14527.html#msg14527 Quote Link to comment Share on other sites More sharing options...
rwblinn Posted July 19, 2016 at 08:08 PM Author Share Posted July 19, 2016 at 08:08 PM Great hint - Many Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.