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 "[email protected]" 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)
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
.
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 @kaylieEB Looks like this can be closed a la #3921
Thanks @olingern !
This is still happening though v1.2.1
strange, i'm getting:
yarn install v1.2.1
warning ../package.json: No license field
but in package.json
:
"license": "MIT",
@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
@chrisdothtml that was totally it, thx man!
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?
@realtebo If you don't intend on publishing it as a package, you can just set "private": true
. That should disable the warning
Thanks, @chrisdothtml . I already did that, but nothing changes.
@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.
@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.
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.
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).
@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
@tony-kerz I was getting this warning when I had a
package.json
sitting in myProjects
root dir (e.g.Projects/my-package
). I must have accidentally runyarn
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.
@tony-kerz I was getting this warning when I had a
package.json
sitting in myProjects
root dir (e.g.Projects/my-package
). I must have accidentally runyarn
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 )))
I have faced same problem i.e
$ yarn babel
yarn run v1.21.1
How I overcome from this?
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
...
:(
@iTonyYo Thanks, it works.
Most helpful comment
@tony-kerz I was getting this warning when I had a
package.json
sitting in myProjects
root dir (e.g.Projects/my-package
). I must have accidentally runyarn
in that directory one time, but deleting that file made the warnings go away