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.

Compilation error with react-scripts 4.0.0 ( Can't resolve file )

See original GitHub issue

latest update of react-scripts to 4.0.0 from 3.4.4 causes a compilation problem. With 3.4.4 it works, and the file exists

./src/styles/mycssfile.css
Error: Can't resolve '/images/module/filename.png' in 'D:\dev\workspace\xxxxxxxxx\src\styles'


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xxxxxxxxxxxxxxx@1.0.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xxxxxxxxxxxxx@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxxxxxxxxxxxxx\AppData\Roaming\npm-cache\_logs\2020-10-23T16_16_47_530Z-debug.log

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:103
  • Comments:70 (1 by maintainers)

github_iconTop GitHub Comments

57reactions
llamamoraycommented, Oct 26, 2020

I’m also seeing this issue where we have an image in /public but it’s not getting resolved when reference in css using url:

.background-image { background: url('/bg.jpg'); }

Error:

./src/styles/style.css (./node_modules/css-loader/dist/cjs.js??ref--4-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/styles/style.css) Error: Can't resolve '/bg.jpg' in '/mnt/c/git/application/src/styles'

51reactions
efeichencommented, Oct 23, 2020

Having a similar issue but with sass url() imports of images in the /public folder

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't resolve SCSS file after upgrade to create-react-app 4.0.1
So I spent all day trying to solve same error. Here's an issue on github on this: https://github.com/facebook/create-react-app/issues/9937.
Read more >
module not found error can't resolve 'fs' react js - You.com
Your quick fix is to take react scripts down to v4 until a fix for v5 is in place unless you are comfortable...
Read more >
Using React with TypeScript - Mattermost
Learn how to create a new TypeScript app with create-react-app and convert an existing create-react-app to TypeScript.
Read more >
Module not found: Error: Can't resolve 'stream' in React project ...
I believe changing react-scripts to 4.0.3 and rerunning yarn install or npm install would've fixed this issue. There are several ways to get...
Read more >
How to fix 'Module not found: Can't resolve 'http' in ... - YouTube
Basically, just change ' react - scripts ' to 4.0.2 in your package.json and run `npm install` again :D Follow me...
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