Skip to content
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

Module not found error #12

Open
svenkanna opened this issue May 11, 2018 · 5 comments
Open

Module not found error #12

svenkanna opened this issue May 11, 2018 · 5 comments

Comments

@svenkanna
Copy link

I found the following error after cloning the code and running npm run start.
./src/App.js
Module not found: Can't resolve 'components/GAListener' in 'xx/xxx/xxx/react-reduction/src/'

However the file does exists but I am not able to find why the error is coming. I tried it on two machines. Both had the problem. Initially I thought it could be machine specific but getting the same error on both the machines, triggered me think that the problem could be something else.

@simsim0709
Copy link
Contributor

@svenkanna hmm..
It's weird. Do you have .env file in the root of repo?
.env file is required and NODE_PATH=./src should exist.

One more question, which node/npm version do you use?

@lazzyms
Copy link

lazzyms commented Jan 30, 2019

I have the similar issue with, Can't resolve 'components/AuthForm' in 'xx/xx/xxx/react-reduction/src'
And yes, I have .env file with NODE_PATH=./src

Node : 10.1.0
NPM: 6.4.1

@dheerajmpai
Copy link

Even I have the same error.

@atulcodex
Copy link

I found the following error after cloning the code and running npm run start.
./src/App.js
Module not found: Can't resolve 'components/GAListener' in 'xx/xxx/xxx/react-reduction/src/'

However the file does exists but I am not able to find why the error is coming. I tried it on two machines. Both had the problem. Initially I thought it could be machine specific but getting the same error on both the machines, triggered me think that the problem could be something else.

it's just file import error, you have to import file properly like ./ notation

@prashathr
Copy link

Looks like you are running this on windows, hence the path is unresolved.
To resolve this install the package cross-env
add the below into the package.jon for the start and build
"start": "cross-env NODE_PATH=./src react-scripts start",
"build": "cross-env NODE_PATH=./src react-scripts build",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants