question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when running npm start with react-scripts 3.3.1 after updating dependencies

See original GitHub issue

Describe the bug

Latest version of react-dev-utils breaks compatibility with old react-scripts.

Did you try recovering your dependencies?

yes

Which terms did you search for in User Guide?

n/a

Steps to reproduce

npx create-react-app bug-test then npm install react-scripts@3.3.1 then npm start.

Expected behavior

Runs webpack-dev-server and watches and compiles files.

Actual behavior

Throws an exception when accessing the page.

The latest version of react-scripts invokes noopServiceWorkerMiddleware with a path, while the previous version did not. This breaks the watch command since the middleware is now joining on undefined, throwing an exception.

This is because react-scripts@3.3.1 pulls in react-dev-utils@10.2.0 since it is versioned with a caret.

TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined at validateString (internal/validators.js:125:11) at Object.join (path.js:1147:7) at noopServiceWorkerMiddleware (/Users/*/projects/bug-test/node_modules/react-dev-utils/noopServiceWorkerMiddleware.js:14:26)

Reproducible demo

Can make one if needed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:24
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

37reactions
voxtexcommented, Feb 15, 2020

Yes upgrading to 3.4.0 fixes it, as does pinning react-dev-utils to previous version. However all projects running react-scripts 3.3.* without dependencies lock (or after npm update) will be broken unless react-dev-utils is fixed to handle the undefined argument. It isn’t a hassle for me, really appreciate all the good work in CRA, just helping those that encounter the error.

10reactions
bploetzcommented, Feb 15, 2020

Thanks for digging into this @voxtex . I was losing my mind all afternoon trying to figure out what I had changed that broke my app. "react-scripts": "^3.4.0" fixes this issue for me as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'npm start' returns error: "There might be a problem with the ...
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >
react-scripts - npm
Start using react -scripts in your project by running `npm i react-scripts`. There are 16306 other projects in the npm registry using ......
Read more >
Old React App Not Starting | Solution | Yarn Start Error
Node JS has been upgraded, react and create- react -app have been upgraded since then. This project will not run now. It needs...
Read more >
react-scripts | Yarn - Package Manager
This package includes scripts and configuration used by Create React App. ... Inside any created project that has not been ejected, run: npm...
Read more >
Npm / react-scripts version issue - The freeCodeCamp Forum
When I type in npm install && npm start I get the following error: ... The react-scripts package provided by Create React App...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found