Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

path to package.json not reading correctly #75

Closed
dsc03 opened this issue Sep 16, 2017 · 1 comment
Closed

path to package.json not reading correctly #75

dsc03 opened this issue Sep 16, 2017 · 1 comment

Comments

@dsc03
Copy link

dsc03 commented Sep 16, 2017

Hi! I'm having an issue where the readJson method is not properly getting the right file path to my package.json. I have the following code:

const readJson = require('read-package-json');
const Promise = require('bluebird');

const readJSON = Promise.promisify(readJson);

readJSON('./package.json', console.error, true)
    .then(response => {
        console.log(response);
    }); 

While the code above works and returns my package.json as an object, the problem is that the actual file path to my package.json is in ('../package.json'). Additionally, I've also tried running this without promises. I'm not sure if this is something that you have built in, but it seemed strange that this method would work for the incorrect file path but then not work for the correct one. Let me know!

@isaacs
Copy link
Contributor

isaacs commented Nov 13, 2019

Can't reproduce this. You realize that the path is relative to the cwd, not the module calling it? Could that be the confusion?

@isaacs isaacs closed this as completed Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants