error: Error: Unable to resolve module @env
See original GitHub issueNo matter what I do, it’s just not working.
babel.config.json:
{
"presets": ["@babel/preset-react","module:metro-react-native-babel-preset"],
"plugins": [
["module:react-native-dotenv", {
"moduleName": "@env",
"path": ".env",
"safe": false,
"allowUndefined": true
}]
]
}
error:
error: Error: Unable to resolve module @env from /Users/maoryadin/spetz-git/project/src/constants/config.js: @env could not be found within the project or in these directories:
node_modules
../../node_modules
1 | import {AppColors, AppSizes, AppStyles} from '../theme';
2 | import {Platform} from 'react-native';
> 3 | import {SERVER_URL, RATING_URL, ENV} from '@env';
I have a .env file that exists.
Issue Analytics
- State:
- Created 9 months ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Error: Unable to resolve module @env · Issue #308 ... - GitHub
Steps to reproduce the behavior: npm install react-native-dotenv; add .env to root dir; config babel.config.js as shown above; add ```import { ...
Read more >react-native-dotenv Unable to resolve module @env
I'm setting up this lib for TypeScript like here. my env :
Read more >Unable to resolve module `@env` from `src/utils.ts` - Issuehunt
error Unable to resolve module `@env` from `config.ts`: @env could not be found within the project. If you are sure the module exists,...
Read more >jkim711 - Sendbird Community
error : Error: Unable to resolve module ./env from /Users/jaekim/code/sendbird_uikit/sendbird-uikit-react-native/sample/src/App.tsx:.
Read more >I have an error it says: Error: Cannot find module '.env'
[nodemon] starting node ./index.js node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module '.env' Require stack: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey, i have successfully succeeded, i think adding import react before has fixes the issue, not sure but its work 😃
Can you please show me a test repo? I haven’t been able to break it.