获取项目根目录路径 var prPath = require('pr-root') prPath.getRootPath('package.json'); prPath.getRootPath('node_modules'); test