Cannot find module socketcan - failing installation of socketcan with npm install


I am reading tutorial from:

I have run

npm install -g socketcan

with a following result

socketcan@2.1.3 install /usr/local/lib/node_modules/socketcan
node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.17"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/socketcan/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/socketcan/build'
  CXX(target) Release/
  SOLINK_MODULE(target) Release/
  COPY Release/can.node
  CXX(target) Release/
  SOLINK_MODULE(target) Release/
  COPY Release/can_signals.node
make: Leaving directory '/usr/local/lib/node_modules/socketcan/build'
socketcan@2.1.3 /usr/local/lib/node_modules/socketcan
âââ nan@2.5.1
âââ xml2js@0.4.17 (sax@1.2.2, xmlbuilder@4.2.1)

Then I have typed:

root@beaglebone:~# node
 var can = require('socketcan');
Error: Cannot find module 'socketcan'
    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 repl:1:11
    at REPLServer.defaultEval (repl.js:132:27)
    at bound (domain.js:291:14)
    at REPLServer.runBound [as eval] (domain.js:304:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)

Do you know why I am getting this error even though the installation seems successful?

Thank you in advance