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

Postinstall fails with SyntaxError: Named export 'copy' not found. #74

Open
2 of 3 tasks
markbrocato opened this issue Aug 7, 2024 · 2 comments
Open
2 of 3 tasks

Comments

@markbrocato
Copy link

Please check all that apply

  • visual bug
  • functional bug
  • able to consistently reproduce

Expected Behavior

"postinstall": "react-flagpack" succeeds

Current Behavior

When running the postinstall task (react-flagpack), I get this error:

> [email protected] postinstall
> react-flagpack

file:///Users/mark/Code/console-ui/node_modules/react-flagpack/cli/flagpack.js:3
import { copy } from 'fs-extra'
         ^^^^
SyntaxError: Named export 'copy' not found. The requested module 'fs-extra' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'fs-extra';
const { copy } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

Node.js v20.15.0
npm error code 1
npm error path /Users/mark/Code/console-ui
npm error command failed
npm error command sh -c react-flagpack

Steps to Reproduce

  1. add "postinstall": "react-flagpack" to package.json scripts
  2. add "react-flagpack": "^2.0.4" to package.json dependencies
  3. run npm i

Your Environment

  • Mac OS
  • Node 20
  • npm 10.7.0
  • turbo monorepo
@zoeyfrisart
Copy link
Member

Hi there,
Apologies it appears I've forgotten to add fs-extra as a dependency.
I'll release a new version that resolves this sometime next week.

In the meantime you can work around this by installing the dependency into your project manually using npm i fs-extra

@zoeyfrisart
Copy link
Member

@markbrocato Just pushed a new version that should resolve this issue! Let me know if you're still facing issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants