Description
What is the current behavior?
Running my project (an app which I work on since several months and its almost finished) via "npm run start-android" throws an exception in the metro bundler:
error: bundling failed: TypeError: Cannot read property 'map' of undefined at resolveDependencies (C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:370:18) at C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:188:33 at Generator.next () at step (C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:298:30) at C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:309:15 at DELTA [android, dev] ....../index.js ▓▓░░░░░░░░░░░░░░ 14.7% (221/612), failed.
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install
and yarn test
.
I really don't know who to achieve that with my complex project, especially when I don't know which part is responsible.
I added a log into the file traverseDependencies.js, function resolveDependencies to log the filename that could be responsible for that. This is the output shortly before the error:
FL_DEBUG: C:\Apps\MyProject\rnw\node_modules\react-native\Libraries\Inspector\ElementBox.js FL_DEBUG: C:\Apps\MyProject\rnw\node_modules\react-native\Libraries\Inspector\ElementProperties.js FL_DEBUG: C:\Apps\MyProject\rnw\node_modules\react-native\Libraries\Inspector\NetworkOverlay.js FL_DEBUG: C:\Apps\MyProject\rnw\node_modules\react-native\Libraries\Inspector\PerformanceOverlay.js FL_DEBUG: C:\Apps\MyProject\rnw\node_modules\react-native\Libraries\Animated\src\nodes\AnimatedTransform.js error: bundling failed: TypeError: Cannot read property 'map' of undefined at resolveDependencies (C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:370:18) at C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:188:33 at Generator.next () at step (C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:298:30) at C:\Apps\MyProject\rnw\node_modules\metro\src\DeltaBundler\traverseDependencies.js:309:15 at DELTA [android, dev] ....../index.js ▓▓░░░░░░░░░░░░░░ 14.7% (221/612), failed.
So I guess maybe C:\Apps\MyProject\rnw\node_modules\react-native\Libraries\Animated\src\nodes\AnimatedTransform.js is responsible for the error?
I really can't say that something I did recently in the code caused that behavior, especially not in the Animated section. I did some changes yesterday but those changes were working fine. I did nothing in the code then, just restarted my computer and started the project again, then suddenly the error appeared.
What is the expected behavior?
Metro starts sucessfully and the app is shown in the emulator like always
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
Windows 10
my package_json:
{
"name": "rnw_boilerplate",
"version": "0.1.0",
"private": true,
"dependencies": {
"formik": "^1.3.2",
"moment": "^2.23.0",
"react": "^16.5.1",
"react-art": "^16.5.1",
"react-dom": "^16.5.1",
"react-native": "^0.57.4",
"react-native-animatable": "^1.3.1",
"react-native-collapsible": "^1.4.0",
"react-native-elements": "^1.0.0-beta7",
"react-native-elevated-view": "0.0.6",
"react-native-fast-image": "^5.1.2",
"react-native-fbsdk": "^0.8.0",
"react-native-localization": "^2.0.3",
"react-native-modal-datetime-picker": "^6.0.0",
"react-native-modal-selector": "^1.0.1",
"react-native-orientation": "^3.1.3",
"react-native-picker-select": "^5.2.2",
"react-native-tab-view": "^1.3.2",
"react-native-vector-icons": "^6.1.0",
"react-native-web": "^0.9.0",
"react-navigation": "^2.18.2",
"react-navigation-backhandler": "^1.2.0",
"react-router-dom": "^4.3.1",
"react-router-modal": "^1.4.2",
"yup": "^0.26.6"
},
"devDependencies": {
"babel-jest": "^23.4.0",
"babel-preset-react-native": "^5",
"jest": "^23.4.1",
"react-scripts": "1.1.5",
"react-test-renderer": "^16.3.1"
},
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"start-ios": "react-native run-ios",
"start-android": "react-native run-android",
"start-web": "react-scripts start",
"build": "react-scripts build",
"test-web": "react-scripts test --env=jsdom",
"eject-web": "react-scripts eject"
}
}
Please let me know if you need more information.
EDIT: More information:
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
Memory: 8.30 GB / 15.90 GB
Binaries:
Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.1.0.0 AI-173.4819257
Activity
react-native-bot commentedon Feb 9, 2019
Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?
👉 Click here if you want to take another look at the Bug Report issue template.
flolege commentedon Feb 10, 2019
Can anyone - not a bot - please tell me what more information is missing in the bug description?
Since it is such an blurry error in the metro bundler, I don't know how to continue providing more details.
flolege commentedon Feb 10, 2019
I solved the issue by emptying the C:\Users<user>\AppData\Local\Temp folder.
vidurajith-darshana commentedon Jul 6, 2019
it's not common to traverse dependencies. I also face that issue. @flolege Thanks for saving my time.
saiakhil97 commentedon Jul 10, 2019
thankyou so much @flolege
gujarnitesh8 commentedon Jul 14, 2019
Thanks @flolege :)
umairkhan1997 commentedon Oct 26, 2019
I copy all the files instead of node module the paste that copied in new folder then i run "npm i" then
the project got run .
JinYuSha0 commentedon Dec 2, 2019
Thank @flolege
learngi commentedon Dec 10, 2019
thank you its really help me to
vellies commentedon Dec 31, 2019
Thank you. it's really helped me.
osamasaeed commentedon Feb 10, 2020
I solved the issue by deleting the C:\Users<USER>\AppData\Local\Temp\metro-cache folder