-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem in image #7
Comments
I'm getting this error too. This comes up at around 42:00 minute mark when you copy and paste the |
Done, might be help with "*" but still got the same error. Tried with any path and got this |
i haven't been able to fix this issue |
The "fix" is to use |
that does'nt seem to fix my issue but thanks in advance |
I have the same error , How can I resolve it ? |
Dude, I'm having this issue too. Tomorrow I will try hard to fix this problem in the best way and come back here with an update for you guys. I guess I have to download yard instead of npm but I will see. |
I have the same error. I read that we need to reinstall npm, but I'm lazy. I just import the images on the page. It works for me |
Yes, it's a problem with the CRA's configuration ... you can import images directly from your src, or even use styled components, for example, regardless of configuration, and it's much better than using CSS 🙂 |
In HeroSection.js file I imported the video and then referenced the import in the return like so:
and then go down into the video tag and update the src like so:
Hope that helps others! |
same issue for me and i made a copy of images in src files and then imported it directly from src and it worked fine for me |
Got same issue. Fixed with @kendrickassignemt's solution. Thank you |
I solved that error long time back , by import that image in file and then using name which I use to import, e.g import image from 'image.jpg' Using {image} at the place where I was using the path of image |
I faced this error , The best solution is to move your images folder to components in the src folder (/src/components/images/img-1.jpg). This is extract the images from src folder. You have to just edit your path in App.css |
Thank you, this was the way to fix for me, anyone know what is the reason behind this problem? May it occur by other projects too? |
I guess no need to do that for video, we can simply add a path of video, and that works fine. |
Moving all your images into src is a horrible solution. The public folder is used for static data. For situations where you have images that have no need to be in the build process, they shouldn't be in the src directory. Do not do lazy programming. do real fixes with clean solutions. A developer should be able to have an img directory in the public folder and should have the ability to reference it in native css. |
To import images or videos from public folder use this : Moving the images or videos is not the answer to the problem. |
@pereiraaron Hi I am new to coding where where would I add the code you recommended? |
change url("/image/img-2.jpg") to src = "/image/img-2.jpg". that should fix the problem |
actually there is no problem but just a difference in syntax. For example, if your images are all in the public folder, then of course it won't be a problem if you follow the code from this tutorial, but if your images are in the src it won't appear and how do you show it? example youre image or assets are in src folder :
example when youre images are in public folder:
|
The assets folder should be in public folder. @jtinik101 please use this code. |
Just change the file path. It will work. Put image files into the components and then |
If somebody is facing the issue regardless of the steps provided above: Your App.js has to look like this: `import React from 'react'; function App() { export default App;` With this you can keep the images in the src folder or the public folder. The .hero-container in herosection.css has to look like this:
I didn't tried it with the video hence I didn't want to include one. This helped me especially because after inspecting the structure in the browser I realized that the just included the navbar and no hero-container. Hope this helps if anybody is still struggling. |
Don't know why it rendered it so poorly but the line |
Failed to compile
./src/App.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/App.css)
Error: Can't resolve '/images/img-2.jpg' in 'C:\Users\kendr\react-website-v1-master\src'
The text was updated successfully, but these errors were encountered: