serverless-esbuild icon indicating copy to clipboard operation
serverless-esbuild copied to clipboard

Package error - couldn't find a script named "list".

Open gdepouilly opened this issue 1 year ago • 3 comments

Describe the bug The package command crashes since the upgrade of yarn from v1.19 to v4.6

To Reproduce

Run yarn serverless package --stage xx

Expected behavior

It should bundle without an error.

Screenshots or Logs

Error: Command failed with exit code 1: yarn list --json --production
Usage Error: Couldn't find a script named "list".

Image

Versions (please complete the following information):

  • OS: macOS 15.2
  • Serverless Framework Version: Framework Core: 3.40.0 (local) Plugin: 7.2.3 SDK: 4.5.1
  • Plugin Version: 1.54.6

Additional context

I'm using yarn v4.6.0, and it seems the list command has been deprecated in favor of info as stated in the docs : https://yarnpkg.com/migration/guide#renamed-commands

gdepouilly avatar Jan 22 '25 08:01 gdepouilly

Haven't tried for Yarn 4.x but for Yarn 3.x try this command to list all versions of installed package yarn info <package-name> However, the yarn why is for the listing all versions of package installed in your project and its dependencies Hope it helps!

j-suhas avatar Mar 26 '25 08:03 j-suhas

+1 can we get this PR in, thanks @boy672820 I updated with yarn patch and it works!

import type { DependenciesResult, PackagerOptions } from '../types';
import type { Packager } from './packager';
interface YarnTree {
    name: string;
    color: 'bold' | 'dim' | null;
    children?: YarnTree[];
    hint?: null;
    depth?: number;
    shadow?: boolean;
  name: string;
  color: 'bold' | 'dim' | null;
  children?: YarnTree[];
  hint?: null;
  depth?: number;
  shadow?: boolean;
}
export interface YarnDeps {
    type: 'tree';
    data: {
        type: 'list';
        trees: YarnTree[];
    };
  type: 'tree';
  data: {
    type: 'list';
    trees: YarnTree[];
  };
}
export interface YarnBerryDep {
  value: string;
  children: {
    Version: string;
    Dependencies?: Array<{
      descriptor: string;
      locator: string;
    }>;
  };
}
/**
 * Yarn packager.

 *   ignoreScripts (false) - Do not execute scripts during install
 */
export declare class Yarn implements Packager {
    private packagerOptions;
    constructor(packagerOptions: PackagerOptions);
    get lockfileName(): string;
    get copyPackageSectionNames(): string[];
    get mustCopyModules(): boolean;
    getVersion(cwd: string): Promise<{
        version: string;
        isBerry: boolean;
    }>;
    getProdDependencies(cwd: string, depth?: number): Promise<DependenciesResult>;
    rebaseLockfile(pathToPackageRoot: string, lockfile: string): string;
    install(cwd: string, extraArgs: Array<string>, hasLockfile?: boolean): Promise<void>;
    prune(cwd: string): Promise<void>;
    runScripts(cwd: string, scriptNames: string[]): Promise<void>;
  private packagerOptions;
  constructor(packagerOptions: PackagerOptions);
  get lockfileName(): string;
  get copyPackageSectionNames(): string[];
  get mustCopyModules(): boolean;
  getVersion(cwd: string): Promise<{
    version: string;
    isBerry: boolean;
  }>;
  getProdDependencies(cwd: string, depth?: number): Promise<DependenciesResult>;
  private parsePackageInfo;
  private collectRootDependencies;
  private processDependency;
  /**
   * 의존성 맵을 구성합니다.
   */
  private buildDependencyMap;
  private getBerryProdDependencies;
  private getClassicProdDependencies;
  rebaseLockfile(pathToPackageRoot: string, lockfile: string): string;
  install(cwd: string, extraArgs: Array<string>, hasLockfile?: boolean): Promise<void>;
  prune(cwd: string): Promise<void>;
  runScripts(cwd: string, scriptNames: string[]): Promise<void>;
}
export {};
//# sourceMappingURL=yarn.d.ts.map

enchorb avatar Jun 22 '25 14:06 enchorb

I hope to see more active support for Yarn Berry in the open source community. That's why I submitted this PR as part of #573.

boy672820 avatar Jun 22 '25 14:06 boy672820