Bug 245425 - www/yarn: throws error when global packages are installed, 1.22.4 regression
Summary: www/yarn: throws error when global packages are installed, 1.22.4 regression
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Luca Pizzamiglio
Keywords: patch
Depends on:
Reported: 2020-04-07 15:30 UTC by Guido Falsi
Modified: 2020-04-14 15:38 UTC (History)
0 users

See Also:
pizzamig: maintainer-feedback+

Patch (3.34 KB, patch)
2020-04-07 15:30 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guido Falsi freebsd_committer 2020-04-07 15:30:17 UTC
Created attachment 213157 [details]


I noticed a regression with yarn 1.22.4. I have some local global packages installed with `yarn global add`.

The error is:

> yarn global upgrade
SyntaxError: Unknown token: { line: 1, col: 0, type: 'INVALID', value: undefined } 1:0 in yarnrc
    at Parser.unexpected (/usr/local/lib/node_modules/yarn/lib/cli.js:64332:11)
    at Parser.parse (/usr/local/lib/node_modules/yarn/lib/cli.js:64463:14)
    at parse (/usr/local/lib/node_modules/yarn/lib/cli.js:64537:21)
    at module.exports.exports.default (/usr/local/lib/node_modules/yarn/lib/cli.js:64099:96)
    at loadRcFile (/usr/local/lib/node_modules/yarn/lib/cli.js:56942:58)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:56916:14
    at /usr/local/lib/node_modules/yarn/lib/cli.js:101331:14
    at Array.map (<anonymous>)
    at parseRcPaths (/usr/local/lib/node_modules/yarn/lib/cli.js:101329:78)
    at Object.findRc (/usr/local/lib/node_modules/yarn/lib/cli.js:101343:10)

and happens with any subcommand.

I studied the thing a little and found an upstream commit which is to blame. I reverted it locally with a patch to the port (attached), and the problem goes away.

I also followed up in an upstream issue report where someone else pointed out the same error on NetBSD:


For reference the problematic upstream commit can be reached here:

Comment 1 commit-hook freebsd_committer 2020-04-14 15:34:58 UTC
A commit references this bug:

Author: pizzamig
Date: Tue Apr 14 15:34:40 UTC 2020
New revision: 531699
URL: https://svnweb.freebsd.org/changeset/ports/531699

  www/yarn: fix regression with global packages

  Add a patch to fix global packages upgrade

  PR:		245425
  Submitted by:	madpilot@
  Obtained from:	https://github.com/yarnpkg/yarn/issues/4884

Comment 2 Luca Pizzamiglio freebsd_committer 2020-04-14 15:38:23 UTC
Committed! Thanks!