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

yarn ignores existing project package.json #2709

Closed
eurochriskelly opened this issue Feb 16, 2017 · 4 comments · Fixed by #4246
Closed

yarn ignores existing project package.json #2709

eurochriskelly opened this issue Feb 16, 2017 · 4 comments · Fixed by #4246
Assignees
Projects

Comments

@eurochriskelly
Copy link

I've been using yarn happily for a while. For most things, it's pretty much a drop-in replacement for npm. However, it behaves very differently if you are working in folders other than the project root. This is unintuitive, unlike npm in a bad way, and results in multiple package.json files peppered throughout the source, all needing to be maintained separately.

For example, let's say my package.json contains a "build" script. From a terminal, I run yarn run build or npm run build and both work as expected. Let's say I cd into directory"test/". npm run build still works but yarn run build complains that there is no package.json.

I would expect that running yarn run build would descend the tree until it finds a package.json file and then build the project as though in that directory (just like npm, gulp, and everything else). I suspect the cause is related to the fact that yarn add "conveniently" creates a package.json file for you if there is no package.json in the current directory, saving you the npm init step. Again, I think yarn add should only do this if it does not find a package.json when descending the tree.

This seems like an unintentional bug to me.

Using yarn version 0.20.1 and Windows 10.

@BYK
Copy link
Member

BYK commented Jul 6, 2017

Hey @eurochriskelly, sorry we missed this earlier. This is certainly a very important thing and we'll now prioritize it accordingly.

@BYK BYK added the cat-feature label Jul 6, 2017
@BYK BYK added this to Backlog in Yarn 1.0 Jul 6, 2017
@BYK
Copy link
Member

BYK commented Jul 6, 2017

We may be able to use this code piece with minor changes: https://github.com/yarnpkg/yarn/blob/master/src/config.js#L573

@torifat torifat self-assigned this Jul 10, 2017
@torifat torifat moved this from Backlog to Active in Yarn 1.0 Jul 16, 2017
@BYK
Copy link
Member

BYK commented Jul 31, 2017

@torifat - Still working on this?

@torifat
Copy link
Member

torifat commented Aug 1, 2017

@BYK I spent some time working on this but couldn't finish it 😞. I have a few questions regarding how it should inside a workspace. I will try to discuss those in Discord.

@BYK BYK reopened this Aug 1, 2017
@BYK BYK moved this from Active to Backlog in Yarn 1.0 Aug 20, 2017
@arcanis arcanis assigned arcanis and unassigned torifat Aug 22, 2017
@arcanis arcanis moved this from Backlog to Awaiting Review in Yarn 1.0 Aug 24, 2017
@BYK BYK moved this from Awaiting Review to Active in Yarn 1.0 Aug 24, 2017
@arcanis arcanis moved this from Active to Awaiting Review in Yarn 1.0 Aug 24, 2017
@BYK BYK moved this from Awaiting Review to Done in Yarn 1.0 Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants