-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
BugHelp Wanted
Issues ideal for external contributors.Issues ideal for external contributors.JavaScriptResolution: LockedThis issue was locked by the bot.This issue was locked by the bot.Tech: Bundler 📦This issue is related to the bundler (Metro, Haul, etc) used.This issue is related to the bundler (Metro, Haul, etc) used.📮Known IssuesThis indicates an issue that refers to a bug or limitation of RN that is not currently being handledThis indicates an issue that refers to a bug or limitation of RN that is not currently being handled
Description
There are various issues scattered around the repo related to this issue. Basically what happens is, for some packages, when you try to require some-module
in a file, for example,
var someModule = require('some-module');
It is unable to resolve the package and the following error appears,
Unable to resolve module some-module from /Users/username/projectname/AwesomeProject/index.js: Invalid directory /Users/node_modules/some-module
This error message is a symptom of the packager not being able to find some-module
. It'll walk up the directory tree until it finds node_modules/some-module
. It just so happens that /Users
is the last directory to try, hence the weird /Users/node_modules
directory in the error message (h/t @philikon).
Workarounds
Currently, the workarounds seem to be,
- Delete the
node_modules
folder -rm -rf node_modules && npm install
- Reset packager cache -
rm -fr $TMPDIR/react-*
ornode_modules/react-native/packager/packager.sh --reset-cache
- Clear watchman watches -
watchman watch-del-all
- Recreate the project from scratch
ignu, zenlambda, tjboAtVidao, BilalBudhani, cherniv and 227 moreJiangJieFS, xilouwangshi, tommydangerous, robmoorman, mowi22 and 193 morequantuminformation, kevinder, cmwall, simonguo, netgfx and 14 moredanbarbarito, ali-master, llli0v0, jessisharon13, umaryouniscode and 18 morearttema, scartick, wangjiake, vitor-mariano, geakstr and 85 moreyadav-rahul, quantuminformation, cosydney, cmwall, hosseind2017 and 17 more
Metadata
Metadata
Assignees
Labels
BugHelp Wanted
Issues ideal for external contributors.Issues ideal for external contributors.JavaScriptResolution: LockedThis issue was locked by the bot.This issue was locked by the bot.Tech: Bundler 📦This issue is related to the bundler (Metro, Haul, etc) used.This issue is related to the bundler (Metro, Haul, etc) used.📮Known IssuesThis indicates an issue that refers to a bug or limitation of RN that is not currently being handledThis indicates an issue that refers to a bug or limitation of RN that is not currently being handled