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

Module not found: Can't resolve './reducers/index' in'C:\Users\Dibba\Desktop\rdx\src'
This error occurred during the build time and cannot be dismissed.
node version is
v9.11.2
npm version is
6.9.1-next.0
structure:
error message :
code:

Your app is not able to find your root reducer since the file name on disk doesn't match the file name in the code. There appears to be a trailing space in the filename of ./reducers/index.js, from what I can see in your first screenshot. Remove the space and your app should be able to find the file without problem.

You have to remove the /index from the directory './reducers/index' and set it to './reducers'. It should work.
If the above does not work for you, check the steps below.
Make sure the reducers folder is created in the 'src' directory and create a file named index.js in the reducers folder.

Related

I am getting error related to firebase when i am doing project in react

Compiled with problems:X
ERROR in ./src/App.js 8:0-30
Module not found: Error: Package path . is not exported from package C:\Users\HARDEE RAVAL\Desktop\ig clone\instagram-clone\node_modules\firebase (see exports field in C:\Users\HARDEE RAVAL\Desktop\ig clone\instagram-clone\node_modules\firebase\package.json)
Did you mean './firebase'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, C:\Users\HARDEE RAVAL\Desktop\ig clone\instagram-clone\node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
enter image description here
This is the problem that i am facing, please anyone who knows firebase, help me. Thanks in advance...

Next.js: ./node_modules/next/dist/client/dev/amp-dev.js

I have a very serious issue right now trying to use Next js. No matter what version I use, any time I try to run the npm run dev, I get the following error:
error - ./node_modules/next/dist/client/dev/amp-dev.js
Module not found: Can't resolve 'C:\Usersudbasili\Documents\Programming\Acumen Developers\myportfolio\node_modules\next\dist\compiled\regenerator-runtime\runtime.js' in 'C:\Users\udbasili\Documents\Programming\Acumen Developers\myportfolio\node_modules\next\dist\client\dev'
error - Error: Cannot find module 'C:\Users\udbasili\Documents\Programming\Acumen Developers\myportfolio\.next\fallback-build-manifest.json'Require stack:
This is literally right after running the create next app command, so I don't install any additional package. One thing realized though is that this error doesn't occur when I use the public folder on my window PC but when I use the user folder called udbasili I get the above error. I have been using next.js for a long time and this is the first I am seeing this error
I had the same issue
the problem was that my project files was in a folder beginning with "ud". My folder name was "udemy".
Renaming that folder or moving the project outside that folder solved the issue
If you compare the paths, there is a missing '\' :
C:\Users**\\**udbasili\Documents\Programming\Acumen Developers\...
C:\Usersudbasili\Documents\Programming\Acumen Developers\...
A quick solution that I gave to this issue was to create the project on a different path. For example:
C:\dev\myportfolio
Please head over to https://nextjs.org/docs/messages/swc-disabled
By disabling swc in next.config.js it will resolve your issue.
You can disable swc by adding:
experimental: {
forceSwcTransforms: true,
}
It's possible your autoimport included '/dist/client/dev' in the 'next/amp' path.
Does it work if you import { useAmp } from 'next/amp'?

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

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

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

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

Resources