This is the error:
I have tried all of the things in the Github issue, in the error description and in this question, to no avail.
Here is my package.json:
{
"name": "MyAppName",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "^24.0.0",
"react-native-scripts": "1.8.1",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"core-js": "^2.5.3",
"expo": "^24.0.2",
"react": "^16.2.0",
"react-native": "^0.51.0",
"react-native-awesome-alerts": "^1.0.3",
"react-native-barcode-builder": "^1.0.2",
"react-native-communications": "^2.2.1",
"react-native-hyperlink": "^0.0.11",
"react-native-image-pan-zoom": "^2.0.16",
"react-native-image-zoom-viewer": "^2.0.18",
"react-native-open-maps": "^0.1.1",
"react-native-swiper": "^1.5.13",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.22",
"rn-viewpager": "^1.2.9"
}
}
FOR ANY FUTURE VIEWERS: This was a dependency issue. If you are using version control, copy your old dependencies into your current package.json
This was a dependency issue. If you are using version control, copy your old dependencies into your current package.json
I couldn't figure out what was wrong so I simply re-cloned my project from GitHub and copied my code over.
Move into your Project folder :
rm -rf node_modules
npm install
Inside package.json. Check if all the modules are present.
react-native start --reset-cache
For me only downgrade npm from 6.1.0 to 6.0.0 helped: npm i -g npm#6.0.0
Unable to resolve module from : Module does not exist in the module map or in these directories:
We’ve found that this error is generally caused by using wildcards (^ or ~) in your package.json.
Our recommendation is to either remove the wildcards, or to move to using yarn and committing your yarn.lock.
Related
I have been successfully using React Navigation Stack (V5) for about a week now and today my app will not build as the error - unable to resolve module is now shown.
Error Message
The module is installed as shown in my package.json file -
{
"scripts": {
"postinstall": "jetify",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.6",
"expo": "~36.0.0",
"expo-linear-gradient": "^8.0.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "~0.61.4",
"react-native-fontawesome": "^7.0.0",
"react-native-gesture-handler": "^1.5.6",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.2",
"react-native-screens": "^2.0.0-beta.2",
"react-native-unimodules": "~0.7.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3"
},
"devDependencies": {
"#babel/core": "~7.6.0",
"babel-jest": "~24.9.0",
"jest": "~24.9.0",
"jetifier": "~1.6.4",
"metro-react-native-babel-preset": "~0.56.0",
"react-test-renderer": "~16.9.0"
},
"jest": {
"preset": "react-native"
},
"private": true
}
I have tried the following steps to try resolve the issue -
Deleted node_modules
Cleared yarn and npm cache
Ran npm install to install dependencies again
Cleared expo cache
Deleted and re-downoaded expo app on iOS device
Also tried installing the react navigation stack package again
Still receiving the same error message.
Would MASSIVELY appreciate any ideas.. currently losing my head over this :|
You don't have #react-navigation/stack or any #react-navigation/xxx packages in your package.json. You have react-navigation-xxx packages which are for v4.
Follow the getting started guide to set it up properly https://reactnavigation.org/docs/en/getting-started.html
Try to delete the package-lock file and run npm i
When I run "npm test" locally, my tests all run fine without issue. However, when I try to run my tests on CircleCI, I am getting the error...
import React from 'react';
^^^^^
SyntaxError: Unexpected identifier
at Runtime._execModule (node_modules/jest-runtime/build/index.js:988:58)
I am not sure where the discrepancy between the two lies. Here is my package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest"
},
"dependencies": {
"#aws-amplify/api": "^1.2.4",
"#aws-amplify/pubsub": "^1.2.4",
"aws-amplify": "^2.2.2",
"aws-amplify-react": "^2.5.4",
"aws-amplify-react-native": "^3.2.0",
"expo": "^35.0.0",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"react-native-gesture-handler": "~1.3.0",
"react-native-modal-dropdown": "^0.7.0",
"react-native-reanimated": "~1.2.0",
"react-native-screens": "^2.0.0-alpha.32",
"react-native-svg": "9.9.5",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.7",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3",
"react-navigation-tabs": "^2.6.0",
"victory-native": "^33.0.0"
},
"devDependencies": {
"babel-preset-expo": "^7.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-react-16-adapter-setup": "^0.1.0",
"enzyme-to-json": "^3.4.3",
"jest": "^24.9.0",
"jest-enzyme": "^7.1.2",
"react-dom": "^16.8.3"
},
"private": true,
"jest": {
"preset": "react-native",
"collectCoverage": true,
"moduleDirectories": [
"node_modules",
"src"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
},
"setupFiles": [
"<rootDir>/jest/setup.js"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|victory-.*)"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"/jest"
]
}
}
and here is my CircleCI .yml file...
version: 2.2
jobs:
build:
docker:
- image: circleci/node:10.15
working_directory: ~/repo/my-app
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v2.2-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v2.2-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v2.2-dependencies-{{ checksum "package.json" }}
# run tests!
- run: npm test
It seems like because I "npm install", all React and Jest elements should work fine. Any ideas on if my configuration seems off?
I see two things that might be the cause of the problem, but take this comment more as a hint rather than a solution.
First, you must be sure to run the same node version as circleci (10.15). You can achieve that with nvm (https://github.com/nvm-sh/nvm).
Then, you should cache package-lock.json as it contains a more fine graned representation of your project dependencies.
Finally remove node_modules/ and install again the dependencies.
I am a newbie with react-native.
I am trying to add expo icons, and when the project is running on the device I get this error:
Screenshot with logs
{
"name": "TrackYourFitness",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"expo": "^36.0.2",
"react": "16.9.0",
"react-native": "0.61.5"
},
"devDependencies": {
"#babel/core": "^7.8.3",
"#babel/runtime": "^7.8.3",
"#react-native-community/eslint-config": "^0.0.6",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.1.0",
"eslint": "^6.8.0",
"eslint-plugin-flowtype": "^4.6.0",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
I tried yarn react-native link, but it didn't work.
How can I fix it? Thanks in advance!
According to your error message, you are trying to call the method downloadAsync from the package expo-file-system.
This package is missing in your package.json.
To install it: run the following command:
expo install expo-file-system
But I don't think this is related to your problem, because you're talking about icons. Icons package is already included in Expo, so it will work.
For reference: https://docs.expo.io/versions/latest/guides/icons/
run
npm install react-native-unimodules
npx pod-install //for ios
made changes in your android file based on IOS and Android
see link
https://docs.expo.io/bare/installing-unimodules/
restart react-native again...
npm start
npx react-native run-android
Happy Coding!!!
Im using expo.
here's my package.json file
{
"name": "emmunize",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "27.0.0",
"react-native-scripts": "^1.14.1",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/vector-icons": "^6.3.1",
"expo": "^27.0.0",
"firebase": "^5.0.2",
"moment": "^2.22.2",
"native-base": "^2.5.2",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz",
"react-native-datepicker": "^1.7.2",
"react-native-router-flux": "^4.0.0-beta.32",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0"
}
}
I dont know what happened, when I try to exp start and exp android this error appeaars. I've followed the latest exp version 27 https://blog.expo.io/expo-sdk-v27-0-0-is-now-available-898bf1e5b0e4 but I think react-native-router-flux has an issue with the latest expo version?
I had the same problem when i was create a new project. As this is the new beta we should wait to the group can solve the bug.
Provisional Solution
Open terminal
Go to project path... Example: user/Documents/ReactNative/(name your project)/
run the command: npm remove react-native-router-flux
run the command: npm install react-native-router-flux#4.0.0-beta.28
run project again to try
react-native-router-flux#4.0.0-beta.28 is a version that i used in the last project and work fine.
I type command create-react-native-app <My package name>
then i type npm start i can see QRCode shows on my terminal
But when i type npm run eject for my project
I type npm start again. There's no QRCode show on my terminal any more.
I looking for some answer still can't fix it. It confused with me a lot.
Here is my environment:
Mac OS:10.13.4
{
"name": "TestMovie2",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-react-native-stage-0": "^1.0.1",
"eslint-config-rallycoding": "^3.2.0",
"jest": "^22.4.3",
"jest-react-native": "^18.0.0",
"react-test-renderer": "16.3.0-alpha.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"#shoutem/animation": "^0.12.2",
"#shoutem/ui": "^0.23.4",
"react": "16.3.0-alpha.1",
"react-native": "0.54.0"
}
}
Hope you have solved the problem , but anyone still facing the problem can just type expo start instead of npm start