-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to resolve path outside root directory #391
Comments
Same issue for me . Hope to fix it, its not a issue for old one. |
I have the same issue with React Native 0.60. What's really strange is I updated my const path = require('path')
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
resolver: {
extraNodeModules: {
"react": path.resolve(__dirname, "node_modules/react"),
"react-native": path.resolve(__dirname, "node_modules/react-native")
}
},
projectRoot: path.resolve(__dirname),
watchFolders: [
path.resolve(__dirname, "../src")
]
} ...and now when I run
But when I try to import my module in import React, { Component } from 'react';
import { Text, View } from 'react-native';
import Pizza from 'pizza' // This is a pizza.js file sitting in ../src
export default class HelloWorldApp extends Component {
render() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Hello, world!!</Text>
</View>
)
}
} ...the bundler spits this out:
I've tried all the things mentioned in that output, but none of them worked. |
I'm also having problem to run a example module that I'm building from scratch.
my app package.json
my module package.json
Sometimes in other projects that I'm working on, I get this error and than I do this and it work. But now I did it for many times but it always the same error. |
Same problem for me to use a local reference module which require react to be peerDependencies. |
Honestly, this is a very surprising problem for first time react-native devs! Especially if you're spinning up a react-native app and trying to share code with a react web app. I'm spoiled by being able to include C++ headers from any path, I guess. |
Any update of this issue ? |
Hey guys, any news about this? |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
unable to resolve path above root directory
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can
yarn install
andyarn test
.create a react native project (all folders inside native directory). Create a new
src
directory sibling tonative
. Create any JS file within thesrc
folder`Now, inside
App.js
file inside your native folder try accessing the JS file fromsrc
dir --error seen:
What is the expected behavior?
able to resolve path.
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
"metro-react-native-babel-preset": "^0.53.0",
git link: https://github.com/abanik0831/nativebug
The text was updated successfully, but these errors were encountered: