Skip to content

np with npm 10.5.1: Failed to parse output of npm pack #740

@karlhorky

Description

@karlhorky

Description

Using npm@10.5.1 (latest as of 3 Apr 2024), the following error message is thrown during publish:

➜  preflight git:(main) np --yolo

✖ Error: Failed to parse output of npm pack
    at Module.getFilesToBePacked (file:///Users/k/Library/pnpm/global/5/.pnpm/np@10.0.2/node_modules/np/source/npm/util.js:147:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Module.getNewFiles (file:///Users/k/Library/pnpm/global/5/.pnpm/np@10.0.2/node_modules/np/source/util.js:107:27)
    at async checkNewFilesAndDependencies (file:///Users/k/Library/pnpm/global/5/.pnpm/np@10.0.2/node_modules/np/source/ui.js:82:19)
    at async ui (file:///Users/k/Library/pnpm/global/5/.pnpm/np@10.0.2/node_modules/np/source/ui.js:138:30)
    at async getOptions (file:///Users/k/Library/pnpm/global/5/.pnpm/np@10.0.2/node_modules/np/source/cli-implementation.js:146:18)
    at async file:///Users/k/Library/pnpm/global/5/.pnpm/np@10.0.2/node_modules/np/source/cli-implementation.js:163:45

This is probably because npm pack with the flags that np uses also returns output with npm v10:

npm pack --dry-run --json --silent

> @upleveled/preflight@6.1.1 build /Users/k/p/preflight
> tsdx build --format esm --target node --tsconfig tsconfig.src.json "--silent"

✓ Building modules 585 ms
[
  {
    "id": "@upleveled/preflight@6.1.1",
    ...

Steps to reproduce

  1. Use a package with a prepare script that generates output
  2. Use npm v10.5.1
  3. Run np

Expected behavior

Package should be published, like it is with npm v9

Environment

np - 10.0.2
Node.js - 20.12.0
npm - 10.5.1
Git - 2.39.2
OS - macOS Sonoma 14.4.1 (23E224)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions