Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--onlyDirectDependencies option returns 0 results if package.json is missing a 'name' property #42

Open
ATClemente opened this issue Jan 20, 2020 · 5 comments

Comments

@ATClemente
Copy link

This may be a bit of a unique scenario but I ran into an issue using npm-licence-crawler with an Expo project I am working on. I thought it would be relatively straightforward as I was following an article from the expo blog: https://blog.expo.io/licenses-the-best-part-of-your-app-29e7285b544f

I found that when running with the --onlyDirectDependencies option, I would always get 0 results. Running with the --dependencies flag returned a large number of results as expected.

I checked the code and determined this was because my package.json has no "name" property. Confirmed that adding a "name" property allows me to get results. My package.json file is this way because by default an Expo project is created with a package.json file that has no "name" property. Instead there is a name property put into an app.json file. Not sure if this has changed since the linked article was written.

I don't know if there are other node projects that could potentially be setup in a way that they would not have a name property so this might just be something people using expo need to watch out for. But perhaps its a scenario that could be handled somehow?

@mwittig
Copy link
Owner

mwittig commented Feb 18, 2020

Thank you very much for your report. I'll check if it is possible to add a tweak to support Expo projects. Strictly speaking package.json file must have a name property as far as I understanding this, see https://docs.npmjs.com/files/package.json

@mwittig
Copy link
Owner

mwittig commented Feb 18, 2020

@EvanBacon Apparently, a new Expo project is created with a package.json file that has no "name" property by default. Instead there is a name property put into an app.json file. Did you also experience this behavior at the time of writing and what is your view on this? My understanding is that a package.json descriptor shall have a name assigned, see https://docs.npmjs.com/files/package.json

@tmtakashi
Copy link

Any updates on this?

@Kiesco08
Copy link

Kiesco08 commented Jul 8, 2020

I was able to get around this by adding name and version properties to my package.json. i.e.

{
   "name": "app-name",
   "version": "1.0.0",
   ...
}

@tdotdm
Copy link

tdotdm commented Mar 7, 2021

@Kiesco08 's solution worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants