You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since issue #308 is closed I'm reporting the same issue here again as I have tried all feedback there and still my error is not resolved. Note that I do not use Expo and installed my react native app using react native cli and when I run npm run android I get the following error in terminal. My Android 14 phone is connected via USB to my macbook and I also can use .env using process.env, but if I use for example import {API_TOKEN} from '@env'; then I get the error you see below.
BUILD SUCCESSFUL in 12s
160 actionable tasks: 10 executed, 150 up-to-date
info Connecting to the development server...
info Starting the app on "R5CX533RM3X"...
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.brryapplication/.MainActivity }
BUNDLE ./index.js
error: Error: Unable to resolve module @env from /Users/sm/Sites/brry/application/src/components/common/Header.tsx: @env could not be found within the project or in these directories:
node_modules
> 4 | import {API_TOKEN} from '@env';
| ^
5 |
6 | const styles = StyleSheet.create({
7 | container: {
at ModuleResolver.resolveDependency (/Users/sm/Sites/brry/application/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:138:15)
at DependencyGraph.resolveDependency (/Users/sm/Sites/brry/application/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
at /Users/sm/Sites/brry/application/node_modules/metro/src/lib/transformHelpers.js:156:21
at resolveDependencies (/Users/sm/Sites/brry/application/node_modules/metro/src/DeltaBundler/buildSubgraph.js:42:25)
at visit (/Users/sm/Sites/brry/application/node_modules/metro/src/DeltaBundler/buildSubgraph.js:83:30)
at async Promise.all (index 6)
at async visit (/Users/sm/Sites/brry/application/node_modules/metro/src/DeltaBundler/buildSubgraph.js:92:5)
at async Promise.all (index 5)
at async visit (/Users/sm/Sites/brry/application/node_modules/metro/src/DeltaBundler/buildSubgraph.js:92:5)
at async Promise.all (index 2)
I have created a custom type decleration env.d.ts like this and then imported but then again, this is not a ideal solution, If any one come up with a nicer one, I'm all ears declare module '@env' { export const GOOGLE_API_KEY: string; }
Since issue #308 is closed I'm reporting the same issue here again as I have tried all feedback there and still my error is not resolved. Note that I do not use Expo and installed my react native app using react native cli and when I run npm run android I get the following error in terminal. My Android 14 phone is connected via USB to my macbook and I also can use .env using process.env, but if I use for example
import {API_TOKEN} from '@env';
then I get the error you see below.Package.json
babel.config.js
tsconfig.json
The text was updated successfully, but these errors were encountered: