这是indexloc提供的服务,不要输入任何密码
Skip to content

@turbo/codemod Unexpected error. Please report it as a bug #9056

@shuther

Description

@shuther

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

na

What package manager are you using / does the bug impact?

npm, Yarn v2/v3/v4 (node_modules linker only)

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

1.13.4

Describe the Bug

I tried to migrate from 1.13.4 -> 2.x using: npx @turbo/codemod update --force (I also tried @canary version)

Need to install the following packages:
@turbo/codemod@2.0.15-canary.3
Ok to proceed? (y) y

npm warn deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
WARNING: Git directory is not clean. Forcibly continuing...
? Where is the root of the repo to migrate? .
Upgrading turbo from 1.13.4 to 2.0.14 (11 required codemods) 

(1/11) Running add-package-manager
 INFO  "packageManager" already set in root "package.json" 

(2/11) Running create-turbo-config
 INFO  Migrating "package.json" "turbo" key to "turbo.json" file... 
 UNCHANGED  turbo.json 
 UNCHANGED  package.json 

Results:
┌──────────────┬─────────────┬───────────┬───────────┬────────┐
│ (index)      │ action      │ additions │ deletions │ error  │
├──────────────┼─────────────┼───────────┼───────────┼────────┤
│ turbo.json   │ 'unchanged' │ 0         │ 0         │ 'None' │
│ package.json │ 'unchanged' │ 0         │ 0         │ 'None' │
└──────────────┴─────────────┴───────────┴───────────┴────────┘

(3/11) Running migrate-env-var-dependencies
 INFO  Migrating environment variable dependencies from "globalDependencies" and "dependsOn" to "env" in "turbo.json"... 

Unexpected error. Please report it as a bug:
TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at Iu (/Users/shuther/.npm/_npx/24554e532d5698bb/node_modules/@turbo/codemod/dist/transforms/migrate-env-var-dependencies.js:39:7068)
    at Object.zS [as transformer] (/Users/shuther/.npm/_npx/24554e532d5698bb/node_modules/@turbo/codemod/dist/transforms/migrate-env-var-dependencies.js:39:8582)
    at Command.Zh (/Users/shuther/.npm/_npx/24554e532d5698bb/node_modules/@turbo/codemod/dist/cli.js:46:9079)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.parseAsync (/Users/shuther/.npm/_npx/24554e532d5698bb/node_modules/commander/lib/command.js:935:5)

Expected Behavior

upgrade turbo to latest version

To Reproduce

n/a

Additional context

migrate failed with (but it seems every steps to change turbo.json went well, the latest one is 11/11 - Running stabilize-ui)

Migration failed
Unable to determine upgrade command
➜  web-main3-git git:(gitbutler/integration) ✗ npx @turbo/codemod      

turbo.json after the 1st pass of migrate before update again:

{
  "$schema": "https://turborepo.org/schema1.json",
  "globalDependencies": [
    "**/.env",
    "**/.env.*local",
    "tsconfig.json"
  ],
  "globalEnv": [
    "PACKAGE_VERSION",
    "NODE_ENV"
  ],
  "globalPassThroughEnv": [
    "CROWDIN_PERSONAL_TOKEN",
    "CROWDIN_PROJECT_ID",
    "GITHUB_TOKEN"
  ],
  "tasks": {
    "topo": {
      "dependsOn": [
        "^topo"
      ]
    },
    "build": {
      "dependsOn": [
        "^build"
      ],
      "env": [
        "\\*",
        "RESEND_API_KEY",
        "\\!NEXT_PUBLIC_GIT_\\*",
        "TINY_BIRD_API_KEY",
        "NODE_ENV",
        "VERCEL_URL"
      ],
      "outputs": [
        ".next/**",
        "!.next/cache/**",
        "next-env.d.ts"
      ],
      "inputs": [
        "$TURBO_DEFAULT$",
        "!README.md"
      ]
    },
    "dev": {
      "persistent": true,
      "cache": false
    },
    "format": {
      "outputs": [
        "node_modules/.cache/.prettiercache"
      ],
      "outputLogs": "new-only"
    },
    "lint": {
      "dependsOn": [
        "^topo"
      ],
      "outputs": [
        "node_modules/.cache/.eslintcache"
      ]
    },
    "typecheck": {
      "dependsOn": [
        "^topo"
      ],
      "outputs": [
        "node_modules/.cache/tsbuildinfo.json"
      ]
    },
    "clean": {
      "cache": false
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugSomething isn't workingneeds: triageNew issues get this label. Remove it after triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions