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

NPM v8 prune fails with package.json unmarshaling error #2270

@weyert

Description

@weyert

What version of Turborepo are you using?

1.6.0.canary.0

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

npm

What operating system are you using?

Mac

Describe the Bug

I am trying to use the prune command which since 1.6.0 canary build also supports NPM v8. Only when I am trying the command turbo prune --scope=demo -vvv then I am getting the following error shown:

❯ turbo prune --scope=demo -vvv         
2022-10-19T03:33:14.981+0100 [ERROR] turbo: error: could not construct graph: 1 error occurred:
        * json: cannot unmarshal array into Go struct field NpmPackage.packages.engines of type map[string]string


 ERROR  could not construct graph: 1 error occurred:
        * json: cannot unmarshal array into Go struct field NpmPackage.packages.engines of type map[string]string

I have searched my package.json in my repo and the only one that includes a engines-property is the one located in the root which has the following value:

  "engines": {    "node": ">= 14"  },

If I remove this property from the package.json-file I am still getting this error. Could it be its reading more package.json files? Maybe in the node_modules-directories that could be problematic? If so, would it be possible to output the path/location problematic package.json's file?

Expected Behavior

Would be able to successfully prune the project when using NPM package manager

To Reproduce

I am working on a repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions