-
Notifications
You must be signed in to change notification settings - Fork 68
Module path
does not exist in the Haste module map
#39
Comments
Same here. Any updates from your side? |
How do you import environment variables in your apps? I had the same issue and resolved it by adding import { VAR1, VAR2 } from 'react-native-dotenv'; instead of import * from 'react-native-dotenv'; |
I'm using the first syntax import { VAR1, VAR2 } from 'react-native-dotenv'; |
I had similar problem - what helped was running |
I'm running into this too, specifically from an expo setup. Not sure what exactly is happening, but it looks like the plugin isn't getting run so it doesn't bother removing the imports and then they are processed by the bundler which complains because |
My issue was related to using a transformer in the // env.js
import { TEST } from 'react-native-dotenv';
export const env = {
TEST: TEST,
}; // env.d.ts
export interface Env {
TEST: string;
}
export const env: Partial<Env>; |
@patsissons for me your solution from here istanbuljs/babel-plugin-istanbul#116 (comment) did it (thanks! 👍). i hope though, this is just a temporary fix. |
make sure you have .env file created and variables are initiated. |
Thank you @patsissons ! |
My issue was that I was operating in a different branch and had forgotten to add "react-native-dotenv" to my .babelrc presets. Your .babelrc presets should look like this: Hope this helps someone! |
From RN 0.56+ the .babelrc presets should have the "module" key: |
Any updates on this? I'm trying to upgrade to RN 0.56 but get the same error message when building. I've also added the module prefix in .babelrc but with no success. |
I'm getting this error with firebase-functions...Pat, can you fill in the blanks on your instructions for somebody who really doesn't understand what's happening? |
sometimes when u import something, it automatically imports some other excessive modules like |
got the same problem resolved it with your help,thank you |
Seeing this issue when upgrading to RN 0.57. I've tried all suggestions and nothing worked for me. In the end I switched to |
on RN 0.57.1 same issue |
its fixed by this jquense/yup#216 (comment) |
@sovanndyul thank you! |
@sovanndyul I've tried everything including |
use |
Removing node_modules and re-adding didn't work for me. BUT as crazy as it sounds, restarting the computer worked! Who knows what it was that actually needed stopping and re-starting, but if you're stuck with this issue, worth a go 👊 |
|
@maxbeech's tip worked for me! |
@xlyasdasd's solution worked for me. If you are trying to import another component from same directory use |
same error here. cannot resolve . |
It seems that what is needed to be cleaned depends on the react-native bundler version. So if cache is the case you can try:
For production build --reset-cache flag can be used, i.e: |
when you're using typescript, and you're using
and if you want to use this component with the latest RN (0.57.8) you should not have a .babelrc but a babel.config.js instead that container
and then use @patsissons solution that worked for me |
yes - I fixed in the end by writing a babel.config.js file like this:
and running |
it worked for me! thanks :) |
@xlyasdasd 's solution worked for me. |
@maxbeech Unbelievable! Restart the computer is really work! |
In case some people run into this issue check the file specified. Somehow this randomly gets added sometimes: import { isAbsolute } from 'path'; Just delete and reset cache and re-run |
@patsissons Thanks for this great workaround, when using // App.tsx
...
import { env } from './env';
...
console.log("TEST is", env.TEST); |
I think it may be possible to use |
I think, what you can do it this: // env.js
import { TEST } from 'react-native-dotenv';
export {
TEST
} // env.d.ts
export const TEST: string; // App.tsx
...
import { TEST } from './env';
...
console.log("TEST is", TEST); |
Getting this: error Command failed with exit code 1. |
I got this, I was adding some style, then I saved changes and stopped working. Weird for me the fact is trying to resolve ´path´from App.js. I have tried all the solutions of the screenshot. I restarted my iMac and getting the same. |
|
If someone still has the same error, make sure
|
use |
I did a lot of the steps previously stated but what ultimately got it to work for me was what was suggested by @maxbeech in restarting my machine. It was the last thing I tried because it didn't sound like it would work but it did haha. |
as @vincentbriglia said, when you're using typescript and can handle it on
|
that fixed it for me |
I faced the same issue when trying to import { ENDPOINT_URL as DOTENV_ENDPOINT_URL } from 'react-native-dotenv'
export const ENDPOINT_URL = DOTENV_ENDPOINT_URL 🤦♂️ |
that fixed it for me 😒 |
"yarn start -c" worked for me with expo, it's for clearing cache |
reinstalling the offending module, then switching between npx worked for me in RN60.0.
|
@maxbeech's tip worked for me also! I don't know how but it does the job |
I got the above error after adding react-native-dotenv to my project when I run
react-native run-ios
Some info about my software context:
macOS 10.13.4
nodeJs v8.11.1
npm 5.6.0
react-native-cli: 2.0.1
react-native: 0.55.2
This my package.json sections about deps
I already tried a brutal cleaning of my project
...but without success
The text was updated successfully, but these errors were encountered: