Skip to content

yarn policies set-version crashes with "request.filter is not a function" #7847

@mgol

Description

@mgol

Bug description

Using Yarn 1.21.1, running yarn policies set-version with ^1.21.1 or 1.21.1 crashes with: request.filter is not a function. Passing berry works.

This happens even in a new directory with package.json containing just {}.

yarn-error.log contents:

Arguments: 
  /Users/me/.nvm/versions/node/v12.14.1/bin/node /usr/local/Cellar/yarn/1.21.1/libexec/bin/yarn.js policies set-version ^1.21.1

PATH: 
  /Users/me/.nvm/versions/node/v12.14.1/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/yarn/bin

Yarn version: 
  1.21.1

Node version: 
  12.14.1

Platform: 
  darwin x64

Trace: 
  TypeError: request.filter is not a function
      at /usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:90113:28
      at Generator.next (<anonymous>)
      at step (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:310:30)
      at /usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:321:13
      at processTicksAndRejections (internal/process/task_queues.js:94:5)

npm manifest: 
  {}

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Command

yarn policies set-version '^1.21.1'

What is the current behavior?

warning package.json: No license field
Resolving ^1.21.1 to a url...
error An unexpected error occurred: "request.filter is not a function".
info If you think this is a bug, please open a bug report with the information provided in "/Users/me/projects/yarn1-test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/policies for documentation about this command.

What is the expected behavior?

It should set the policy. If there's anything wrong with my environment, it should say that explicitly instead of crashing in a random place.

Steps to Reproduce

  1. Create an new directory with package.json consisting of just {}.
  2. Run yarn policies set-version '^1.21.1'

Environment

  • Node Version: 12.14.1
  • Yarn v1 Version: 1.21.1
  • OS and version: macOS 10.15.2 (19C57)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions