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

Root package.json is not used #2693

Closed
SiggyF opened this issue Feb 14, 2017 · 4 comments
Closed

Root package.json is not used #2693

SiggyF opened this issue Feb 14, 2017 · 4 comments

Comments

@SiggyF
Copy link

SiggyF commented Feb 14, 2017

Do you want to request a feature or report a bug?
Report a bug.

What is the current behavior?
I try to install a package from a subdirectory. Yarn creates a new package.json in that subdirectory instead of in the package root.

If the current behavior is a bug, please provide the steps to reproduce.

mkdir parent
cd parent
yarn init
yarn add request
mkdir child
cd child
yarn add --dev lodash
cd ..
rm -r node_modules/ child/node_modules/
find .

This results in 2 package.json files, on in parent and one in child, together with 2 yarn.lock files.

.
./child
./child/package.json
./child/yarn.lock
./package.json
./yarn.lock

What is the expected behavior?
Based on the documentation ("...within the root directory of your package...") I would expect yarn to find my package.json in the top directory and install the package there.

Please mention your node.js, yarn and operating system version.
nodejs: 4.4.3
yarn: 0.19.1
OS: OSX 10.11.6

@hpurmann
Copy link
Contributor

Unfortunately, most of the commands don't work if executed in sub-directories. I don't know the desired behaviour here.

@eigood
Copy link

eigood commented May 25, 2017

npm install, npm run, both find the correct root. yarn variants don't. It's enough to make me not use yarn.

@silverwind
Copy link

The desired behaviour should be to search for package.json in parent directories up to the filesystem root and then install into its parent directory.

I run into this issue almost daily when I forget to cd to the project root before yarn add.

@BYK
Copy link
Member

BYK commented Sep 18, 2017

This is fixed by #4246 but it will not work for yarn init after #4441 is closed.

@BYK BYK closed this as completed Sep 18, 2017
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