Failed building JavaScript bundle error when application starts
See original GitHub issueDescription
When I first create a create-react-native-app project and scan qr on my phone with expo, It threw javascipt bundling error instead of starting.
Expected Behavior
I expect to see my lovely first working react-native application
Observed Behavior
11:21:59: Failed building JavaScript bundle
11:21:59: Error: Expected path `C:\Users\Naim\Documents\projects\nativedeneme\node_modules\metro-bundler\src\Resolver\polyfills\prelude_dev.js` to be relative to one of the project roots
11:21:59: at toLocalPath (C:\Users\Naim\Documents\projects\nativedeneme\node_modules\metro-bundler\src\node-haste\lib\toLocalPath.js:33:9)
11:21:59: at ModuleCache.createPolyfill (C:\Users\Naim\Documents\projects\nativedeneme\node_modules\metro-bundler\src\node-haste\ModuleCache.js:166:18)
11:21:59: at DependencyGraph.createPolyfill (C:\Users\Naim\Documents\projects\nativedeneme\node_modules\metro-bundler\src\node-haste\DependencyGraph.js:312:30)
11:21:59: at map.moduleName (C:\Users\Naim\Documents\projects\nativedeneme\node_modules\metro-bundler\src\Resolver\index.js:150:38)
11:21:59: at Array.map (native)
11:21:59: at Resolver.getModuleSystemDependencies (C:\Users\Naim\Documents\projects\nativedeneme\node_modules\metro-bundler\src\Resolver\index.js:150:5)
11:21:59: at _resolverPromise.then.resolver (C:\Users\Naim\Documents\projects\nativedeneme\node_modules\metro-bundler\src\Bundler\index.js:273:31)
11:21:59: at <anonymous>
11:21:59: at process._tickCallback (internal/process/next_tick.js:188:7)
Environment
npm ls react-native-scripts
: react-native-scripts@1.5.0npm ls react-native
: react-native@0.48.4npm ls expo
: expo@21.0.2node -v
: v8.2.1npm -v
: 4.6.1yarn --version
: ‘yarn’ is not recognized as an internal or external commandwatchman version
: Please specify a target and action
- Operating system: Windows 10 Pro 1703
- Phone/emulator/simulator & version: Galaxy J7 (2016) SM-J710FQ Android 7.0 (Expo 1.20.0) (Nexus_5X_API_25_2 Android 7.1.1 and Nexus_5X_API_23 Android 6.0 emulators in Android Studio gave same error)
Reproducible Demo
npm install -g create-react-native-app
create-react-native-app nativedeneme
cd nativedeneme
npm start
Scan QR code with Expo on the phone
node_modules\metro-bundler\src\node-haste\lib\toLocalPath.js: (this dude is unhappy I think)
'use strict';var _require =
require('path');const relative = _require.relative;
// FIXME: This function has the shortcoming of potentially returning identical
// paths for two files in different roots.
function toLocalPath(
roots,
absolutePath)
{
for (let i = 0; i < roots.length; i++) {
const localPath = relative(roots[i], absolutePath);
if (localPath[0] !== '.') {
return localPath;
}
}
throw new Error(
`Expected path \`${absolutePath}\` to be relative to one of the project roots`);
}
module.exports = toLocalPath;
Installing yarn and using it instead of npm for everything gave same error.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
React Native Expo Failed building JavaScript bundle
I get the following error message in the logs of exp start when I try to launch the simulator on Xcode: Failed building...
Read more >Failed building JavaScript bundle error when application starts
When I first create a create-react-native-app project and scan qr on my phone with expo, It threw javascipt bundling error instead of starting....
Read more >Building JavaScript bundle: error - Expo Development Tools
I'm getting this error on my first project. i have not added any library ... Expo Dev browser window Building JavaScript bundle: error...
Read more >Addressing common errors in React Native - LogRocket Blog
Solution 1: Package the bundle correctly. All of your app's JavaScript is bundled into the index.android.bundle file.
Read more >Troubleshooting - React Native
You will also need to update your applications to load the JavaScript bundle from the new port. If running on device from Xcode,...
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 FreeTop 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
Top GitHub Comments
i only stop the bundle with ctrl+c (on windows) and again start the project, npm start and the app works fine without errors
Ignoring these lines like this fixed my issue, I think they are not necessary for me right now 😄
edit: DO NOT USE THIS, JUST UPDATE YOUR EXPO APP AND CREATE CREATE-REACT-NATIVE-APP TO C://