question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't resolve module paths in parent directories

See original GitHub issue

I use lerna for mono-repo, and here is my folder structures:

monorepo
  |-- lerna.json
  |-- packages/
  |     |-- foo/                # module `@foo`
  |-- apps/
        |-- react-native-app/   # react-native project
              |-- package.json

In my react-native-app project, I use local module @foo by lerna, and lerna will make a symlink in the apps/react-native-app/node_modules.

After running react-native start, it failed to bundle the js code:

error: bundling failed: "Unable to resolve module `@foo` from `{path_to_file}`: Module does not exist in the module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`."

To resolve this, I need to add --root when bundling to search the paths for symlink in the node_modules by lerna:

$ react-native start --root ../../packages

Now, I can’t find a way to pass search paths to storybook node server.

$ storybook -p 7007 --root ../../packages

  error: unknown option `--root'

How can I use local lerna modules with storybook?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
rmevans9commented, Sep 11, 2017

Yes, my plan is to take an inventory of what options you can pass react-native start and make them work with the storybook cli.

2reactions
rmevans9commented, Sep 6, 2017

Yes but it likely will not be till next week at some time that I can do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't resolve module paths in parent directories #1804 - GitHub
In my react-native-app project, I use local module @foo by lerna, and lerna will make a symlink in the apps/react-native-app/node_modules .
Read more >
Webpack fails to import module in parent directory
The webpack config considers that your working directory is defined by context. Your context is set to someDir, your component is outside ...
Read more >
Documentation - Module Resolution - TypeScript
A non-relative import can be resolved relative to baseUrl , or through path mapping, which we'll cover below. They can also resolve to...
Read more >
Error: Module not found on paths with a space in them - bud
Hi Bud version 6 has ModuleNotFound-Errors if a parent directory has a space in its name. It worked though in version 5.
Read more >
Module Resolution - webpack
A resolver is a library which helps in locating a module by its absolute path. A module can be required as a dependency...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found