Module not found: Can't resolve './AppRoutes' - reactjs

I'm following this react workshop:
https://github.com/spietrek/workshop.reactjs.1/blob/master/presentation/Introduction%20to%20ReactJS%20Workshop.pdf
I'm following all the code but I'm getting an error:
Module not found: Can't resolve './AppRoutes'...
Here's the editable project url:
https://stackblitz.com/edit/react-project
I'm at pg 17/27

You have put a space before the name of the file AppRoutes.js like <space>AppRoutes.js.
You have to remove the space to fix that error.
After fixing this also in you project there are some errors due to Fragment. I fixed that by updating react and react-dom packages to version 16.2.0.
This is a working fork of you project.

If AppRoutes is a .jsx file you have to load it with the .jsx file extension. Like ./AppRoutes.jsx

Related

Module not found: Error: Package path ./compat is not exported from package

I'm working on my project and all of a sudden, I got the following message from the compiler and don't know how to solve the problem:
ERROR in ./src/frontend/service/AuthService.ts 8:0-39
Module not found: Error: Package path ./compat is not exported from package /Users/chuben/Desktop/Coding_Projects/ecommerce-react-node/final.frontend.project/node_modules/firebase (see exports field in /Users/chuben/Desktop/Coding_Projects/ecommerce-react-node/final.frontend.project/node_modules/firebase/package.json)
ERROR in ./src/frontend/ui/page/RegisterPage/index.tsx 14:0-39
Module not found: Error: Package path ./compat is not exported from package /Users/chuben/Desktop/Coding_Projects/ecommerce-react-node/final.frontend.project/node_modules/firebase (see exports field in /Users/chuben/Desktop/Coding_Projects/ecommerce-react-node/final.frontend.project/node_modules/firebase/package.json)
I don't understand what the problem is and how should I export the path correctly? I will really appreciate anyone who can help solve this problem. Thanks in advance!
Hopefully, I don't have to do everything from scratch by starting a new project.
I found the issue there. I shouldn't set the following in my React page, or else the system will try to search the module for the variable or sth.
const [firebaseUid,setFirebaseUid]=useState<String|undefined>(undefined);

Why can't the Web Browser find these modules, resolve, and compile the page?

In a React project, I am trying to run the app on a live server in the web browser. However when I command CD Ravenous to go to the right file and npm start, the browser gives me the following error:
./src/index.js
Module not found: Can't resolve './App' in '/Users/mauricemarkslag/ravenous/src'
I've checked if the imports have been filled in correctly, and that should be the case now I guess. However the error doesn't seem to be fixed with this code:
Code file
Folder structure
Does anybody know what I might do wrong?
You have a typo, you should use ./app.css instead of ./App.css, and I am assuming that the file that you put in your question is app.js.

Module not found. Can't resolve 'assets/styles/constants'

I've wanted to add Expo in my React Native project to start it in a web browser. After doing that, I try to import file 'assets/styles/constants.ts'. This is my tsconfig.json:
tsconfig.json
This is constants.ts:
constants.ts
And here I try to import this file:
DropdownAlertCustom.tsx
After that, I get this error:
error message
What am I doing wrong? And how I can fix it?
UPD
Small fix of tsconfig.json:
small fix
Now I get the error 'Cannot find a module or it's corresponding type declarations:
Cannot find module
UPD 2
I understood that my IDE and VSCode see files and folders fine by these paths. When I hover on them, I can see their's content. I get the error Module not found. Can't resolve 'assets/styles/constants' when I type expo start --web. It starts in a browser and I get this error.
Maybe the problem is in Expo? I've added it in Create React Native app.
If anyone has any suggestions, please, help.
Replace assets/styles/constants with ../../../assets/styles/constants
Explanation
If you import like this assets/styles/constants, webpack that compiles your project into common js file that thinks that assets is the package name and that's why it will find in node_mouldes folder and it cant resolve the folder.
so if you want to import something from your local files you can give a relative path to that folder and import it successfully like I specified ../../../assets/styles/constants.
EDIT 1
It's the only way that create-react-app provides you to import any file but, there is another way you can build it manually called absolute path.
Like you can tell webpack that make src folder as the root of my project and if I specify # in URL than means its absolute path and root is src
after that you can call it as
#/assets
#/pages
#/store
#/anything/any

How to use Scrollmagic and GSAP in REACT project

I'm following using this codesandbox as a guide with my React project and receiving this error:
./node_modules/scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js
Module not found: Can't resolve 'TimelineMax'
Assuming I copied everything from that sandbox to my local files, why am I getting that error?
I'm using Create-react-app btw.
animation.gsap.js requires TimelineMax module so try importing 'TimelineMax' module
import { TimelineMax} from 'gsap/src/uncompressed/TweenMax.js';
also you can refer to github solution

failed to compile React projects

I am busy with a project of React and
When I want run a browser I get this error.
./src/Components/ui/icons.js
Module not found: Can't resolve './src/Resources/images/logos/manchester_city_logo' in 'C:\Users\Daniel\Desktop\mancity\src\Components\ui'
This error occurred during the build time and cannot be dismissed.
I made sure of correct names of folders. Is it a npm webpack?
You are most probably referring to a non-existed media file or using wrong file extension when importing manchester_city_logo (probably in icons.js)
Doublecheck the source path for desired media file in icons.js

Resources