Yummygum / react-flagpack

Flagpack contains 250+ flag icons to easily use within your code project.
https://flagpack.xyz
MIT License
130 stars 26 forks source link

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

Open markbrocato opened 1 month ago

markbrocato commented 1 month ago

Please check all that apply

Expected Behavior

"postinstall": "react-flagpack" succeeds

Current Behavior

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

> console-monorepo@0.0.0 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

zoeyfrisart commented 1 month ago

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 commented 1 month ago

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