Do you want to request a feature or report a bug?
A bug, maybe?
What is the current behavior?
The behaviour of yarn add in a directory with no package.json has changed between 0.16.1 and master. I'm not sure whether it's intentional or not.
Behaviour with 0.16.1 is that it creates an empty package.json file:
21:25 daniel@vps03 /tmp/loltest
% yarn add react
yarn add v0.16.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 16 new dependencies.
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹斺攢 [email protected]
Done in 3.27s.
21:25 daniel@vps03 /tmp/loltest
% cat package.json
{
"dependencies": {
"react": "^15.3.2"
}
}
Behavior with the latest master build is that it fails:
% yarn add react
yarn add v0.17.0-0
info No lockfile found.
error Couldn't find a package.json file in "/tmp/loltest"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Please mention your node.js, yarn and operating system version.
Node v6.9.1
Debian Testing (Stretch)
Created #1787 to fix this, pending approval.
@kittens I've just upgraded to yarn 0.19.1 and I'm trying to install from a github repository without a package.json file and I still get Couldn't find manifest error.
Thanks
Same here. For example:
yarn add github:github/testrepo
yarn add v0.19.1
info No lockfile found.
[1/4] 馃攳 Resolving packages...
error Couldn't find manifest in "https://github.com/github/testrepo.git".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
I am also having the same issue with Yarn 0.24.5
@kittens your merge seems that it didn't solve the problem, probably it would be worth to add a new
--ignore-manifest option to the yarn add CLI ?
@metaunicorn your solution didn't worked for me.
I tried running:
yarn add https://github.com/dragosu/jquery-aciTree/tarball/master --ignore-manifest
it still given error:
Couldn't find a package.json file
Am i missing anything?
@imsurinder90 my suggestion to @kittens was to add a NEW option called --ignore-manifest to the CLI, but it doesn't exist yet :(
This should be fixed in master,
0.28 release
Running echo '{}' > package.json before yarn add should work too.
@Daniel15 i tried but it displays the same error on terminal
@Daniel15, the problem is that package.json is missing from https://github.com/dragosu/jquery-aciTree/tarball/master not the project that adds it.
This PR (in yarn 0.27) added ability to refer git repos without package.json https://github.com/yarnpkg/yarn/pull/3701.
But I am not sure it will work for a tarball git dependency.
@bestander Will it work if i fork this repo and add a package.json to it ?
and then run yarn add git+forkUrl
Also, i found the latest version of yarn(0.27) is yet not available at npm package repository.
Can someone tell when latest version of yarn will be available on npm pkg repo ?
Will it work if i fork this repo and add a package.json to it ?
and then run yarn add git+forkUrl
Yes
Also, i found the latest version of yarn(0.27) is yet not available at npm package repository.
thanks, we do it manually, I'll promote 0.27 to stable now
Thanks
Hi
I forked the repo and add a package.json file to it. it works:
yarn add git+https://github.com/imsurinder90/jquery-aciTree.git
but i need to download specific version, so i tried:
yarn add git+https://github.com/imsurinder90/jquery-aciTree.git#4.5.0-rc.7
this time it fails with error:
error Couldn't find manifest in git+https://github.com/imsurinder90/jquery-aciTree.git.
Do i suppose to add manifest file to it ? I can add to it as i have forked it.
Also in this thread @metaunicorn had suggested to add '--ignore-manifest' flag in yarn add CLI. Will it be available in the upcoming latest version ?
@imsurinder90 --ignore-manifest won't help you, this is not related to the feature you are looking for.
https://github.com/yarnpkg/yarn/pull/3624 - here was added capability to add git dependencies without package.json in [email protected].
But I think it is not working end to end yet.
As for yarn add git+https://github.com/imsurinder90/jquery-aciTree.git#4.5.0-rc.7, #4.5.0-rc.7 part is a tag and the commit with this tag still does not have a package.json. You'll probably want to clone the source at a specific tag and add package.json there and then refer a specific commit.
E.g. yarn add git+https://github.com/imsurinder90/jquery-aciTree.git#efd4c1fb62e0a9c74f8a559f2c2c3df89b02953f
@bestander
Did you mean to clone from original repo with commit id and then add a package.json to it and push that all of code into my personal github account and then refer that repository.
It has nothing to do with forked repo?
Here is the workaround:
@bestander 馃憤
Thanks for the perfect solution :)
Is it possible to have a flag control this? I often mistakenly run yarn in wrong folder and had to remove created yarn.lock package.json node_modules stuff manually.
Might some config like create_package_json_if_not_exists false in .yarnrc
That is to say I'd like to make yarn install/yarn add fails when no package.json found, just like other package manager do.
At least make yarn without any argument not creating empty yarn.lock and node_modules if package.json not present.
Most helpful comment
@kittens I've just upgraded to yarn 0.19.1 and I'm trying to install from a github repository without a
package.jsonfile and I still getCouldn't find manifesterror.Thanks