Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the path to the global npm_modules within javascript?

How can I get the path to the global npm_modules within javascript?

From command line, I can get the base path to the npm modules by calling this:

npm config get prefix

How, can I get this path within a javascript file? Is there some module I can use to get this path?

I am trying to configure my protractor.config.js file to specify the paths for seleniumServerJar and chromeDriver, (which are installed globally), and I need to know the path to the global npm modules so I can specify these paths.

like image 872
Will Avatar asked Nov 10 '22 17:11

Will


1 Answers

There is an environment variable NODE_PATH which is how node finds its node_modules dir

console.log(process.env.NODE_PATH);
like image 127
Scott Stensland Avatar answered Nov 14 '22 23:11

Scott Stensland