diff --git a/index.js b/index.js index ffacb4e..87b05ee 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ module.exports = function nmTree (basePath, tree) { const packageJsonPath = path.join(basePath, 'package.json') const nodeModulesPath = path.join(basePath, 'node_modules') if (fs.existsSync(packageJsonPath)) { - const packageJson = JSON.parse(fs.readFileSync(packageJsonPath)) + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8').trim()) tree[basePath] = packageJson if (fs.existsSync(nodeModulesPath)) { // TODO: and is dir const nodeModulesPackages = fs.readdirSync(nodeModulesPath)