Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: The requested module 'execa' does not provide an export named 'default' when installing dependency #4655

Closed
6 tasks done
wojtekmaj opened this issue Dec 4, 2023 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@wojtekmaj
Copy link
Contributor

wojtekmaj commented Dec 4, 2023

Describe the bug

Ignoring the fact #4575 caused vite to be falsely reported as missing, I went ahead and asked for it to be installed.

I got an error:

file:///.yarn/__virtual__/vitest-virtual-64d4633324/0/cache/vitest-npm-1.0.1-9a3034a0e7-e59bab2c0a.zip/node_modules/vitest/dist/chunks/install-pkg.ORGzQeqb.js:5
import execa from 'execa';
       ^^^^^
SyntaxError: The requested module 'execa' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:213:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async ensurePackageInstalled (file:///.yarn/__virtual__/vitest-virtual-64d4633324/0/cache/vitest-npm-1.0.1-9a3034a0e7-e59bab2c0a.zip/node_modules/vitest/dist/vendor/node.mLeBfrTn.js:84:12)
    at async startVitest (file:///.yarn/__virtual__/vitest-virtual-64d4633324/0/cache/vitest-npm-1.0.1-9a3034a0e7-e59bab2c0a.zip/node_modules/vitest/dist/vendor/node.mLeBfrTn.js:14782:8)
    at async start (file:///.yarn/__virtual__/vitest-virtual-64d4633324/0/cache/vitest-npm-1.0.1-9a3034a0e7-e59bab2c0a.zip/node_modules/vitest/dist/cli.js:134:17)

I tracked it down to a bundled version of @antfu/install-pkg version 0.1.1, which at the time was using a different, older version of execa that provided default exports. Since this dependency is bundled, it's using the same execa version vitest declares, and consequently, it errors out.

Suggested fix:
Update @antfu/install-pkg which since then has been updated not to use default export in execa.

Reproduction

  • Install vitest using Yarn PnP
  • Run vitest
  • Upon facing
     MISSING DEP  Can not find dependency 'vite'
    
    ? Do you want to install vite? › (y/N)
    
    confirm installation

System Info

  System:
    OS: macOS 14.1.1
    CPU: (8) arm64 Apple M2
    Memory: 32.31 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - /private/var/folders/3y/swkjq1x101b76mzjgt4pm2d80000gp/T/xfs-2ac5acc4/node
    Yarn: 4.0.2 - /private/var/folders/3y/swkjq1x101b76mzjgt4pm2d80000gp/T/xfs-2ac5acc4/yarn
    npm: 10.1.0 - /usr/local/bin/npm
    bun: 1.0.12 - ~/.bun/bin/bun
  Browsers:
    Chrome: 119.0.6045.199
    Edge: 119.0.2151.97
    Safari: 17.1

Used Package Manager

yarn

Validations

@wojtekmaj wojtekmaj changed the title [v1.0.1] [v1.0.1] SyntaxError: The requested module 'execa' does not provide an export named 'default' when installing dependency Dec 4, 2023
@wojtekmaj wojtekmaj changed the title [v1.0.1] SyntaxError: The requested module 'execa' does not provide an export named 'default' when installing dependency SyntaxError: The requested module 'execa' does not provide an export named 'default' when installing dependency Dec 4, 2023
@userquin
Copy link
Member

userquin commented Dec 4, 2023

#4593

@AriPerkkio
Copy link
Member

Duplicate of #4589 as the root cause is same.

@AriPerkkio AriPerkkio closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2023
@AriPerkkio AriPerkkio added duplicate This issue or pull request already exists and removed pending triage labels Dec 5, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants