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 global not detecting license in package.json #3821

Closed
OmgImAlexis opened this issue Jul 4, 2017 · 23 comments
Closed

Yarn global not detecting license in package.json #3821

OmgImAlexis opened this issue Jul 4, 2017 · 23 comments

Comments

@OmgImAlexis
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Installing global packages doesn't always detect license field.

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

yarn global add xo
➜  agenda git:(feature/update_dev_deps) ✗ yarn global add xo          
yarn global v0.27.5
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "xo@0.18.2" with binaries:
      - xo
warning No license field
Done in 47.10s.
➜  agenda git:(feature/update_dev_deps) ✗ which xo
/usr/local/bin/xo
➜  agenda git:(feature/update_dev_deps) ✗ realpath /usr/local/bin/xo
/Users/xo/.config/yarn/global/node_modules/xo/cli.js
➜  agenda git:(feature/update_dev_deps) ✗ cat /Users/xo/.config/yarn/global/node_modules/xo/package.json | grep license
  "license": "MIT",

What is the expected behavior?
For it to install without a warning about missing license.

Please mention your node.js, yarn and operating system version.
Node: v8.1.3
Yarn: 0.27.5
OS: macOS Sierra 10.12.3 (16D32)

@GAumala
Copy link
Contributor

GAumala commented Jul 4, 2017

I tried to debug this, and it seems that what yarn is complaining about is not the license for package xo, but the license for the user's package.json file. When yarn global is used, yarn keeps a package.json with all the packages that the user has installed globally listed as dependencies. Right now, mine looks something like this:

{
  "dependencies": {
    "create-react-app": "^1.3.1",
    "typescript": "^2.3.2",
    "xo": "^0.18.2"
  }
}

Those 3 are the only packages that I have installed globally in my system. As you can see, this file does not have a license, not even a name, so that's why a warning is thrown. Maybe the validate function in normalize-manifest could receive an extra parameter to skip this check when running yarn global.

@BYK
Copy link
Member

BYK commented Jul 5, 2017

Maybe the validate function in normalize-manifest could receive an extra parameter to skip this check when running yarn global.

@bestander @arcanis I think this is the way to go. What do you think?

@BYK BYK added this to Backlog in Yarn 1.0 Jul 5, 2017
@kaylie-alexa kaylie-alexa self-assigned this Jul 13, 2017
@kaylie-alexa kaylie-alexa moved this from Backlog to Awaiting Review in Yarn 1.0 Jul 13, 2017
@BYK BYK moved this from Awaiting Review to Done in Yarn 1.0 Jul 14, 2017
arcanis pushed a commit that referenced this issue Jul 14, 2017
* skip manifest validation when it's in global folder

* Add tests
@olingern
Copy link
Contributor

olingern commented Sep 9, 2017

@BYK @kaylieEB Looks like this can be closed a la #3921

@kaylie-alexa
Copy link
Member

Thanks @olingern !

@tgdn
Copy link

tgdn commented Oct 13, 2017

This is still happening though v1.2.1

@tony-kerz
Copy link

strange, i'm getting:

yarn install v1.2.1
warning ../package.json: No license field

but in package.json:

  "license": "MIT",

@chrisdothtml
Copy link

@tony-kerz I was getting this warning when I had a package.json sitting in my Projects root dir (e.g. Projects/my-package). I must have accidentally run yarn in that directory one time, but deleting that file made the warnings go away

@tony-kerz
Copy link

@chrisdothtml that was totally it, thx man!

@realtebo
Copy link

I've the need to keep package.json in the root of my react-native app.

How to turn off this warning in this case?

@chrisdothtml
Copy link

@realtebo If you don't intend on publishing it as a package, you can just set "private": true. That should disable the warning

@realtebo
Copy link

Thanks, @chrisdothtml . I already did that, but nothing changes.

gmarziou added a commit to gmarziou/generator-jhipster that referenced this issue Oct 26, 2017
When generating an app without client code, upgrade generator fails because yarn complains about no licence. Adding `"private": true` to `package.json` avoids this error and makes a lot of sense as there'sn o npm module to publish anyway.

See yarnpkg/yarn#3821
@iTonyYo
Copy link

iTonyYo commented Aug 1, 2018

@realtebo When u had a package.json or yarn.lock sitting in your system root, just cd ~, then u can find package.json & yarn.lock. U must deleting those files made the warnings go away.

@realtebo
Copy link

realtebo commented Aug 1, 2018

@iTonyYo : I am no more on the situation I reported some months ago, so I cannot try anything.

But I like your reply and sticked the link into my personal dashboard, in the future I'll find it as first result before system will go on google to search.

@panzer-planet
Copy link

This issue has been closed but the problem has not been fixed. Why is yarn looking up the directory structure when it has already found the package.json file in the current directory? It's quite common for projects to exist inside other projects while in development state, especially using gitmodules.

@arcanis
Copy link
Member

arcanis commented Aug 6, 2018

Why is yarn looking up the directory structure when it has already found the package.json file in the current directory?

The problem described previously was that there was no package.json in the current directory iirc. You might want to open a new issue (with precise repro steps, please).

@begueradj
Copy link

@chrisdothtml packagge.json should not removed from your project because when you work with a subversion system, the user who will clone your repository will not be able to install the dependencies.

Billal Begueradj

@niblux
Copy link

niblux commented Dec 17, 2018

@tony-kerz I was getting this warning when I had a package.json sitting in my Projects root dir (e.g. Projects/my-package). I must have accidentally run yarn in that directory one time, but deleting that file made the warnings go away

This worked perfectly, i was messing around installing/re-installing node the other and forgot i didnt clean up after myself.

@javasparx
Copy link

@tony-kerz I was getting this warning when I had a package.json sitting in my Projects root dir (e.g. Projects/my-package). I must have accidentally run yarn in that directory one time, but deleting that file made the warnings go away

just additional info, I have removed package.json and yarn.lock from parent directories too, directories were not projects, dont know how they appear there )))

@hemantkumar5151
Copy link

I have faced same problem i.e
$ yarn babel
yarn run v1.21.1

How I overcome from this?

@jonatasJS
Copy link

jonatasJS commented Apr 22, 2020

PS C:\Users\admin\Desktop\aulinhas\chat-react> create-react-app front

Creating a new React app in C:\Users\admin\Desktop\aulinhas\chat-react\front.

warning ..\..\..\..\package.json: No license field
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4
warning ..\..\..\..\package.json: No license field 

...

:(

@bochoi
Copy link

bochoi commented Jun 9, 2020

@iTonyYo Thanks, it works.

@anzhelikavv
Copy link

@tony-kerz I was getting this warning when I had a package.json sitting in my Projects root dir (e.g. Projects/my-package). I must have accidentally run yarn in that directory one time, but deleting that file made the warnings go away

I also have package.json in my Project root directory. But I think it used to be there, I'm afraid if I delete this file my framework will break. But I don't know what is the problem, my code used to run and pass, and now out of nothing I started getting this

yarn run v1.22.11
warning package.json: No license field
$ wdio run wdio.conf.ts

Please HELP!

@anzhelikavv
Copy link

@tony-kerz I was getting this warning when I had a package.json sitting in my Projects root dir (e.g. Projects/my-package). I must have accidentally run yarn in that directory one time, but deleting that file made the warnings go away

just additional info, I have removed package.json and yarn.lock from parent directories too, directories were not projects, dont know how they appear there )))

Hi, did you just removed package.json and yarn.lock? And it didn't affect the framework?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests