-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
error: Error: Unable to resolve module @env #308
Comments
Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/308 |
I get that devs got to eat too, but since this library does not work and only addresses bugs when paid, I found this one Simple and works, no need to modify babble, just standard modern auto-link and pods |
Did you install as dev dependency? Sorry about the issue. I'd like to be able to help Up to you. That's still a good library if you want to deal with linking. This is a JS solution. |
@goatandsheep was I supposed to install this as a dev dependency? |
Yes it should be dev dependency |
Same problem here. Have now installed as dev dependency but was not resolved |
How can I help? Are you using typescript? How are you trying to import? Is it possible to show the project? |
Thank you very much for your readiness to help. Here is the URL https://github.com/YouRik/RNDotenvTest which you should have access to, @goatandsheep. I have imported it according to the steps in this project's README:
Do you know if there is a way to avoid this error in the linter? |
Typically you can avoid this by using "react-native-dotenv" as your "moduleName". |
As you should see, that is what I did. Do you see anything else that was not set up correctly? Do you get the same error when cloning the repo I linked? |
I'm sorry, my mind was apparently preoccupied with something else. |
Hi , can i access the Env variable map api key in androidmanifest.xml file in react native? thanks in Advance |
I also got the same error, when using the @env import in a |
i found the solution, just add, |
when i use babel-plugin-module-resolver,it does't work. |
If you are using TS. This solved my issue https://dev.to/bhatvikrant/how-to-add-environment-variables-in-a-react-native-project-with-ts-2ne5 |
As discussed in goatandsheep#308, the "easy instructions" recommended in the Readme do not work. This commit removes the easy instructions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
First I've did yarn add dotenv react-native-dotenv expo-constants |
having this problem too. couldn't fix it. |
What does your Babel look like? What version of library are you on? |
babel file
and in one of my js i use it like this:
and the error I get: Unable to resolve "@env" from "src/utils/...js" |
Is react-native-dotenv a dev dependency? Also keep API.cache(false) |
no, it is not |
well when I kept API.cache(false) it worked. I have no idea why. |
I'm so glad 🙌 but I do advise you keep it as a devDependency |
it works for me! thanks a lot |
It does not work for me |
Hi @iovreche please open a new ticket with your project details. I'm locking this |
Describe the bug
A clear and concise description of what the bug is.
Fresh install getting
babel.config.js
based on documentation as folows:To Reproduce
Steps to reproduce the behavior:
npm install react-native-dotenv
.env
to root dirbabel.config.js
as shown aboveExpected behavior
A clear and concise description of what you expected to happen.
I expect
@env
to be defined so I can import from the.env
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Have tried killing metro and simulator, but problem presisits
The text was updated successfully, but these errors were encountered: