Jump to content

Node Error "Cannot find module 'tinkerforge'"


rwblinn

Recommended Posts

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.

 

Link zu diesem Kommentar
Share on other sites

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

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...