Error: Cannot find module 'blynk-library'

I have installed blink-library and dht11 sensor files via npm install on raspberry pi 2. I tried the export NODE_PATH=/usr/local/lib/node_modules and still get the above error.
But if i start the script i get the following error message:

pi@raspberrypi:~ $ sudo NODE_PATH="/usr/local/lib/node_modules" node ./blynk-sensor-test.js
throw err;
Error: Cannot find module ‘blynk-library’
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/home/pi/blynk-sensor-test.js:1:78)
at Module._compile (module.js:460:26)
at Object.Module._extensions…js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)

my code dht11 sensor example js

please help me

when you do npm install ..., please note where you module was placed (it outputs lots of info)
NODE_PATH should correspond to that.
you can try setting NODE_PATH before you call npm install:

sudo su
npm install ...
node ./script.js

If you run node.js under windows and have this issue.

  1. Click Menu/My computer/right click on properties.
  2. Then click to advanced system settings/Environment variables/new…
    variable name: NODE_PATH
    variable value: %AppData%\npm\node_modules
    Then reboot (mandatory)

This is suitable for global installing module via> npm install -g blynk-library
otherwise you have to put actual path.