Skip to content

Instantly share code, notes, and snippets.

@lepture
Created March 15, 2013 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save lepture/5167275 to your computer and use it in GitHub Desktop.
Save lepture/5167275 to your computer and use it in GitHub Desktop.
check NODE_PATH
if (!process.env.NODE_PATH) {
console.log();
if (process.env.SHELL === '/bin/zsh') {
console.log(' Please set environment variable NODE_PATH in ~/.zshrc:');
} else if (process.env.SHELL === '/bin/bash') {
console.log(' Please set environment variable NODE_PATH in ~/.bashrc:');
} else {
console.log(' Please set environment variable NODE_PATH:');
}
console.log();
var nodepath = __dirname.replace(/(\/|\\)nico(\/|\\)bin$/, '');
if (/node_modules$/.test(nodepath) && !fs.existsSync(path.join(nodepath, '.bin'))) {
if (os.platform() === 'win32') {
console.log(' NODE_PATH=' + nodepath);
} else {
console.log(' export NODE_PATH=' + nodepath);
}
}
console.log();
process.exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment