Thursday, April 10, 2014

Fix "Cannot find module OpenStudio" for Node.js Bindings on Ubuntu Linux

ERROR: Cannot find module 'OpenStudio'



PROBLEM: Your JavaScript cannot find where the OpenStudio software libraries are.  



SOLUTION

1. Login as user & add to $PATH
export NODE_PATH=/usr/local/lib/openstudio/node
PATH=$PATH:/usr/local/lib/openstudio/node
sudo -s 
sudo echo 'export NODE_PATH=/usr/local/lib/openstudio/node' >> /etc/profile 
sudo echo 'export PATH=$PATH:$NODE_PATH' >> /etc/profile
2. Login as root & add to $PATH
sudo -i 
sudo echo 'export NODE_PATH=/usr/local/lib/openstudio/node' >> /etc/environment
sudo echo 'export PATH=$PATH:$NODE_PATH' >> /etc/environment

TEST
echo $PATH
echo $NODE_PATH

/usr/local/lib/openstudio/node must show up

POST SPECIFIC TO : Linux Ubuntu 12.04
REFERENCE
Jason Turner, Empty Crate
http://askubuntu.com/questions/128413/setting-the-path-so-it-applies-to-all-users-including-root-sudo

FULL ERROR
module.js:340
    throw err;
          ^
Error: Cannot find module 'OpenStudio'
    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/energyplus.io-live/routes/openstudio-run.js:2:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

No comments:

Post a Comment