mhassan1 / yarn-plugin-licenses

Yarn Berry plugin that adds `yarn licenses` commands
42 stars 11 forks source link

Error with Upgrade to Yarn v4.0.1 #50

Closed mwarres closed 12 months ago

mwarres commented 12 months ago

I am working on a project using yarn and yarn-plugin-licenses at v0.13.0. I ran yarn set version 4.0.1. Upon running yarn install, I got the error:

Type Error: at.ZipOpenFS is not a constructor (when initializing @yarnpkg/plugin-licenses,...

Running subsequent yarn commands including yarn --version and yarn cache clean resulted in the same error. How do you recommend I proceed?

mhassan1 commented 12 months ago

The error ZipOpenFS is not a constructor tells me that you are still running Yarn v3. Can you comment out the entry for this plugin in .yarnrc.yml and then run yarn -v?

mwarres commented 12 months ago

Aha! You are correct. I followed your instructions. The output of yarn -v was 3.6.3. Thanks for the insight!

mwarres commented 12 months ago

Sorry, I should have made sure it worked upon upgrade before commenting. I ran yarn cache clear and yarn set version 4.0.1. At this point, running yarn -v resulted in the expected 4.0.1. However, when I uncommented the entry for this plugin and ran yarn install, I got the same error as before: Type Error: at.ZipOpenFS is not a constructor (when initializing @yarnpkg/plugin-licenses,.... What do you recommend at this point? Thanks so much for your help!

mhassan1 commented 12 months ago

That's surprising. Can you paste the .yarnrc.yml and package.json here? Or can you come up with a minimal reproduction?

mwarres commented 12 months ago

Sure. Here is the .yarnrc.yaml:

plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
    spec: "@yarnpkg/plugin-typescript"
  - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
    spec: "@yarnpkg/plugin-interactive-tools"
  - path: .yarn/plugins/@yarnpkg/plugin-stage.cjs
    spec: "@yarnpkg/plugin-stage"
  - path: .yarn/plugins/@yarnpkg/plugin-licenses.cjs
    spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-licenses/v0.13.0/bundles/@yarnpkg/plugin-licenses.js"

# Keep in sync with package.json.
yarnPath: .yarn/releases/yarn-4.0.1.cjs

Here is the package.json:

{
  "name": "ptreatyourselfv2",
  "version": "0.0.0",
  "private": true,
  "description": "Self-Assess and Treat Five Times Sit to Stand",
  "author": "Megan Warres <megan.warres@gmail.com>",
  "packageManager": "yarn@4.0.1",
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emotion/react": "11.11.1",
    "@emotion/styled": "11.11.0",
    "@fontsource/roboto": "5.0.8",
    "@mui/material": "5.14.17",
    "next": "14.0.2",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "@mui/types": "7.2.8",
    "@tsconfig/strictest": "2.0.2",
    "@types/eslint": "8.44.7",
    "@types/node": "18.18.0",
    "@types/prettier": "3.0.0",
    "@types/react": "18.2.37",
    "@types/react-dom": "18.2.15",
    "@typescript-eslint/eslint-plugin": "6.10.0",
    "@typescript-eslint/parser": "6.10.0",
    "@yarnpkg/sdks": "3.0.0",
    "eslint": "8.53.0",
    "eslint-config-next": "14.0.2",
    "eslint-config-prettier": "9.0.0",
    "prettier": "3.0.3",
    "typescript": "5.2.2"
  }
}

Thanks again for your help!

mhassan1 commented 12 months ago

My hunch is that v0.13.0 of this plugin is not actually installed. Can you try commenting it out again in .yarnrc.yml, then run yarn plugin import https://raw.githubusercontent.com/mhassan1/yarn-plugin-licenses/v0.13.0/bundles/@yarnpkg/plugin-licenses.js?

mwarres commented 12 months ago

Good idea! Pretty sure that resolved it. Thanks again for your help.