Skip to content

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

@markbrocato

Description

@markbrocato

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:

> 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

  • Mac OS
  • Node 20
  • npm 10.7.0
  • turbo monorepo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions