Skip to content

Error when running npx iconfont-init: Cannot find module 'fs-extra' #17

@LeleDallas

Description

@LeleDallas

When trying to run npx iconfont-init in my React project after installing react-iconfont-cli using npm, I encountered the following error:

Error: Cannot find module 'fs-extra'
Require stack:
- .../node_modules/react-iconfont-cli/commands/createJson.js

To resolve this issue, I installed the fs-extra module manually using npm i fs-extra, and after that, the command worked as expected.

Steps to Reproduce:

  1. Create a new React project or use an existing one.
  2. Install react-iconfont-cli by running npm install react-iconfont-cli --save-dev.
  3. Attempt to run npx iconfont-init in the project directory.

Expected Behavior:

npx iconfont-init should run without any errors and initiate the icon font setup successfully.

Actual Behavior:

The command throws an error: Cannot find module 'fs-extra'.

Proposed Solution:

It appears that the fs-extra module is required by the react-iconfont-cli package, but it was not installed automatically as a dependency. To resolve this issue, users should manually install fs-extra using the following command:

npm install fs-extra

After installing fs-extra, running npx iconfont-init should work as expected.

Additional Information:

  • Node version: 18.15.0
  • NPM version: 9.5.0
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions