drone-npm icon indicating copy to clipboard operation
drone-npm copied to clipboard

Crash when publishing from a wokspace folder

Open pitininja opened this issue 3 months ago • 0 comments

Hello,

I have a monorepo with multiple workspaces configured in the root package.json :

{
    "workspaces": [
        "packages/core",
        "packages/resolvers/typebox",
        "packages/resolvers/zod"
    ]
}

Each of these workspaces is a package I want to publish. I have the following step in my CI (Woodpecker) :

- name: npm-core
  image: plugins/npm:latest
  pull: true
  settings:
    folder: 'packages/core'
    username:
      from_secret: npm_user
    token:
      from_secret: npm_token

The error is :

+ npm view @********/envious versions --json
time="2025-10-01T16:30:54Z" level=error msg="execution failed: could not determine if package should be published: invalid character 'p' in literal null (expecting 'u')"

I have found by debugging that the cause is a warning that is displayed in the console when executing npm view @pitininja/envious versions --json placed in a workspace folder. Output is :

npm warn Ignoring workspaces for specified package(s)
[
  "1.0.0",
  "1.0.1",
  "1.0.2",
  "1.0.3",
]

The JSON parser crashes because of the warning placed at the beginning of the output.

I don't really known how to fix this : is it a configuration problem on my part, how I handle the workspaces ? Or could you hide the warnings when running this command to avoid parsing problems ?

FYI the temporary solution is a step just before using the plugin that set the log level to error :

- name: npm-fix
  image: alpine:latest
  commands:
  - echo "loglevel=error" >> .npmrc

Regards

pitininja avatar Oct 01 '25 17:10 pitininja