Skip to content

[BUG] Error when extracting a directory after updating from 13.0.4 to 15.0.3 #241

@dutchigor

Description

@dutchigor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hi,

I use Pacote to install packages in electron during runtime. I just updated from 13.0.4 to 15.0.3 and one of my test cases now fails with the error: DirFetcher requires either a tree or an Arborist constructor to pack.
This test case takes a valid package (only package.json) from an existing folder and extracts it to the installation folder.

After looking in to your source code, I found that Arborist is now required for extracting a directory. Simply importing Arborist as a dependency and including it as an option in the extract call seems to solve my problem. However, I have no idea what this actually does. Is this the correct solution to my problem or will this cause other problems in production with other specifier types?

Expected Behavior

Calling extract with just a source dir as spec and destination dir as dest should successfully move a valid package from ./pluginsSrc to ./plugins.

Steps To Reproduce

  1. In a new npm project with pacoate as dependency, create a folder called pluginSrc and add a valid package.json in it.
  2. Create another folder in the test folder called pluginDest
  3. Execute the following js:
    const { extract } = require("pacote")
    extract('./pluginSrc', './ pluginDest')

Environment

  • npm: 8.15.0
  • Node: 16.17.0
  • OS: Windows 10
  • platform: ASUS Zenbook

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds an initial review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions