Skip to content

Fix: strip-ansi not found error. #13489

@Jbordhen

Description

@Jbordhen

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-dev-utils@12.0.1 for the project I'm working on.

strip-ansi not found error due to strip-ansi v7 being a Es module only package. Changed the package name to strip-ansi-cjs.

Here is the diff that solved my problem:

diff --git a/node_modules/react-dev-utils/FileSizeReporter.js b/node_modules/react-dev-utils/FileSizeReporter.js
index b2b4cc6..d7c0df5 100644
--- a/node_modules/react-dev-utils/FileSizeReporter.js
+++ b/node_modules/react-dev-utils/FileSizeReporter.js
@@ -12,7 +12,7 @@ var path = require('path');
 var chalk = require('chalk');
 var filesize = require('filesize');
 var recursive = require('recursive-readdir');
-var stripAnsi = require('strip-ansi');
+var stripAnsi = require('strip-ansi-cjs');
 var gzipSize = require('gzip-size').sync;
 
 function canReadAsset(asset) {
diff --git a/node_modules/react-dev-utils/eslintFormatter.js b/node_modules/react-dev-utils/eslintFormatter.js
index 4e8280c..61ee60f 100644
--- a/node_modules/react-dev-utils/eslintFormatter.js
+++ b/node_modules/react-dev-utils/eslintFormatter.js
@@ -9,7 +9,7 @@
 
 const path = require('path');
 const chalk = require('chalk');
-const stripAnsi = require('strip-ansi');
+const stripAnsi = require('strip-ansi-cjs');
 const table = require('text-table');
 
 const cwd = process.cwd();

This issue body was partially generated by patch-package.

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