create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Invalid string length error thrown

Open wmonk opened this issue 7 years ago • 6 comments
trafficstars

Is this a bug report?

Yes

After running react-script for a while, I get an exception thrown with the stacktrace:

/Users/will/Code/collect/node_modules/webpack/lib/Stats.js:221
                                        text += `\n @ ${current.readableIdentifier(requestShortener)}`;
                                                                ^

RangeError: Invalid string length
    at formatError (/Users/will/Code/collect/node_modules/webpack/lib/Stats.js:221:30)
    at Array.map (<anonymous>)
    at Stats.toJson (/Users/will/Code/collect/node_modules/webpack/lib/Stats.js:229:56)
    at Compiler.<anonymous> (/Users/will/Code/collect/node_modules/html-webpack-plugin/index.js:68:44)
    at Compiler.applyPluginsAsyncSeries (/Users/will/Code/collect/node_modules/tapable/lib/Tapable.js:206:13)
    at Compiler.emitAssets (/Users/will/Code/collect/node_modules/webpack/lib/C

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

invalid string length

Environment

  1. node -v: v8.4.0
  2. yarn --version (if you use Yarn): 1.3.2
  3. npm ls react-scripts (if you haven’t ejected): 1.1.1

Then, specify:

  1. Operating system: Mac os
  2. Browser and version (if relevant): n/a

Steps to Reproduce

(Write your steps here:)

  1. run yarn start
  2. make a few changes, causing recompliation
  3. wait until the error happens

Expected Behavior

This shouldn't happen

Actual Behavior

The error above gets thrown into the terminal, and the process stops.


I've seen this error reported in a few different repos:

  • https://github.com/jantimon/html-webpack-plugin/issues/855
  • https://github.com/webpack/webpack/issues/6501

wmonk avatar Feb 23 '18 09:02 wmonk

I also had this issue, though I'm not using create-react-app, just webpack-dev-server.

It seems be working after changing the devtool option to something else, and then back again, in the webpack config & freeing up some RAM

Node: 8.9.5 OS: Win 7

reohjs avatar Feb 26 '18 17:02 reohjs

Very weird -- we're upgrading to webpack 4 soon and discontinuing use of webpack-dev-server, so hopefully this goes away in 2.x.

Timer avatar Mar 05 '18 01:03 Timer

Also experiencing this:

  • Create React App: 1.4.3
  • Webpack: 3.8.1
  • Webpack Dev Server: 2.11.3
  • OS: Windows 10 Pro version 1803
  • Node: 8.9.1 (will update this, assume that had no effect if I do not follow up)

Behaviour exhibits itself after seemingly random amount of time after running npm start, abridged error:

\node_modules\webpack\lib\Stats.js:221
    text += `\n @ ${current.readableIdentifier(requestShortener)}`;

jmcgrory avatar Oct 15 '18 10:10 jmcgrory

Is this still a thing thats happening?

eddiemonge avatar Jul 11 '20 15:07 eddiemonge

@eddiemonge unfortunately yes

jmcgrory avatar Jul 14 '20 07:07 jmcgrory

I'm suddenly having this problem and have no clue why. The error is not helpful. It just breaks on a useEffect() call that hasn't failed me for over a year now. My project is DOA until I muddle my way through this issue.

vgjenks avatar Oct 18 '22 16:10 vgjenks