Answers for "how to print NODE_PATH"

0

how to print 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();
}
Posted by: Guest on November-25-2019

Code answers related to "Javascript"

Browse Popular Code Answers by Language