how to print node path

Solutions on MaxInterview for how to print node path by the best coders in the world

showing results for - "how to print node path"
Loann
04 Feb 2020
1if (!process.env.NODE_PATH) {
2  console.log();
3  if (process.env.SHELL === '/bin/zsh') {
4    console.log(' Please set environment variable NODE_PATH in ~/.zshrc:');
5  } else if (process.env.SHELL === '/bin/bash') {
6    console.log(' Please set environment variable NODE_PATH in ~/.bashrc:');
7  } else {
8    console.log(' Please set environment variable NODE_PATH:');
9  }
10
11  console.log();
12
13  var nodepath = __dirname.replace(/(\/|\\)nico(\/|\\)bin$/, '');
14  if (/node_modules$/.test(nodepath) && !fs.existsSync(path.join(nodepath, '.bin'))) {
15    if (os.platform() === 'win32') {
16      console.log(' NODE_PATH=' + nodepath);
17    } else {
18      console.log(' export NODE_PATH=' + nodepath);
19    }
20  }
21  console.log();
22  process.exit();
23}