Search code examples
debiancloud9-idebeagleboneblack

module.js 340 error Cannot find module 'bonescript'


I am getting this error when trying to use 'bonescript'. I have gone through the many solutions discussed on this forum related to this problem but unfortunately I am not getting. I am using Debian OS

The code which I want to run

var b = require('bonescript');
 
b.pinMode('P8_12', b.INPUT);
b.pinMode('P8_13', b.OUTPUT);
 
setInterval(copyInputToOutput, 100);
 
function copyInputToOutput() {
    b.digitalRead('P8_12', writeToOutput);
    function writeToOutput(x) {
        b.digitalWrite('P8_13', x.value);
    }
}

I am getting following error

module.js:340
throw err;
^
Error: Cannot find module 'bonescript'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/ubuntu/workspace/blinky.js:1:71)
etc...


Solution

  • Did you do npm install bonescript in the project folder? It can't find that module most likely because it's not installed, or if it is installed it may not have the correct permissions for your app to load it.