Skip to content

Instantly share code, notes, and snippets.

@xexi
Forked from lepture/nodepath.js
Created May 10, 2019 02:11
Show Gist options
  • Save xexi/70f78e4e2a87fa69f4dcdedf452831cb to your computer and use it in GitHub Desktop.
Save xexi/70f78e4e2a87fa69f4dcdedf452831cb 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