storybook : Unable to resolve module path from node_modules/#storybook/store/dist/cjs/autoTitle.js - react-native

I'm using a storybook with a react native project and this project is inside a lerna project. while running yarn && yarn start in one terminal then yarn run-android I have this error:
error: Error: Unable to resolve module path from /home/front/node_modules/#storybook/store/dist/cjs/autoTitle.js: path could not be found within the project or in these directories:
node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
38 | var _startCase = _interopRequireDefault(require("lodash/startCase"));
39 |
> 40 | var _path = _interopRequireDefault(require("path"));
| ^
41 |
42 | var _slash = _interopRequireDefault(require("slash"));
43 |
at ModuleResolver.resolveDependency (/home/front/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:129:15)
at DependencyGraph.resolveDependency (/home/front/node_modules/metro/src/node-haste/DependencyGraph.js:288:43)
at Object.resolve (/home/front/node_modules/metro/src/lib/transformHelpers.js:129:24)
at resolve (/home/front/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
at /home/front/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (/home/front/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
at processModule (/home/front/node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Done in 451.87s.
This file /home/front/node_modules/#storybook/store/dist/cjs/autoTitle.js do exists. so for me The storybook need to know how to look for this file but I don't know how to tell him.
Do you have any idea ?

Related

fbjs/lib/invariant could not be found within the project or in these directories:s:413:43)

i just did ( npm audit fix ) in my porject and after that im getting this error .
error:
Error: Unable to resolve module fbjs/lib/invariant from C:\Users\HP\Desktop\NoumanTestingApp-master\node_modules\react-native-reanimated\src\createAnimatedComponent.js: fbjs/lib/invariant could not be found within the project or in these directories:s:413:43)
node_modulesresolve (C:\Users\HP\Desktop\NoumanTestingApp-master\node_modules\metro\src\lib\transformHelpers.js:317:42
....\node_modules
at resolve (C:\Users\HP\Desktop\NoumanTestingApp-master\node_modules\metro\src\DeltaBundler\traverseDependencies.js:
If you are sure the module exists, try these steps:
Clear watchman watches: watchman watch-del-all\node_modules\metro\src\DeltaBundler\traverseDependencies.js:645:26
Delete node_modules and run yarn install
Reset Metro's cache: yarn start --reset-cacheoumanTestingApp-master\node_modules\metro\src\DeltaBundler\traverseDepe
Remove the cache: rm -rf /tmp/metro-*
10 | import setAndForwardRef from './setAndForwardRef';odules\metro\src\DeltaBundler\traverseDependencies.js:329:33
11 | Generator.next (<anonymous>)
12 | import invariant from 'fbjs/lib/invariant';manTestingApp-master\node_modules\metro\src\DeltaBundler\traverseDepen
| ^
13 | import { adaptViewConfig } from './ConfigHelper';d. Please run:
14 | import { RNRenderer } from './reanimated2/platform-specific/RNRenderer';
15 |orm[stderr]:
i try npm install fbjs but it doesn't work for me

react-native could not be found within the project or in these directories: node_modules

I am new to react native, I was learning the Axios, for that I tried to install it by using command
npm install axios
but later on, my app started showing this error
error: Error: Unable to resolve module react-native from D:\work\app_dev\AxiosWorking\AxiosProject\index.js: react-native could not be found within the project or in these directories:
node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
3 | */
4 |
> 5 | import {AppRegistry} from 'react-native';
| ^
6 | import App from './App';
7 | import {name as appName} from './app.json';
8 |
at ModuleResolver.resolveDependency (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:129:15)
at DependencyGraph.resolveDependency (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\node-haste\DependencyGraph.js:288:43)
at Object.resolve (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\lib\transformHelpers.js:129:24)
at resolve (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
at D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
at processModule (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
at async traverseDependenciesForSingleFile (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\DeltaBundler\traverseDependencies.js:131:3)
at async traverseDependencies (D:\work\app_dev\AxiosWorking\AxiosProject\node_modules\metro\src\DeltaBundler\traverseDependencies.js:60:7)

Unable to resolve module #react-native-async-storage/async-storage

Getting this error after adding aws-amplify to the project, Did complete setup for aws-amplify according to the docs, then pod install and react-native run-ios
I have also tried changing the import statement as mentioned in the suggestion below error, still doesn't work, Thanks in advance.
node_modules/#aws-amplify/core/node_modules
node_modules
../node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
11 | * and limitations under the License.
12 | */
> 13 | import AsyncStorage from '#react-native-async-storage/async-storage';
| ^
14 | var MEMORY_KEY_PREFIX = '#MemoryStorage:';
15 | var dataMemory = {};
16 | /** #class */
at ModuleResolver.resolveDependency (/Users/monk/Projects/Airbnb/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:234:15)
at DependencyGraph.resolveDependency (/Users/monk/Projects/Airbnb/node_modules/metro/src/node-haste/DependencyGraph.js:413:43)
at Object.resolve (/Users/monk/Projects/Airbnb/node_modules/metro/src/lib/transformHelpers.js:317:42)
at resolve (/Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:629:33)
at /Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:645:26
at Array.reduce (<anonymous>)
at resolveDependencies (/Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:644:33)
at /Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:329:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:24)```
Install Amplify libraries: here,
yarn add #react-native-async-storage/async-storage
After that Try cleaning the project if there is an issue,
rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && yarn cache clean --force && rm -rf ios/build && rm -rf node_modules/
yarn install
rm -rf pods && pod install
I just deleted the app from the emulator and reinstalled it and it finally worked after a long time of research that led to no emends!
delete your node_modules & reinstall your node_modules
I resolve so - in package.json
"#react-native-community/async-storage": "https://github.com/react-native-async-storage/async-storage",

React Native 0.59 -> 0.60 - Unable to resolve module `NativeModules`

I want to make sure that my native library works on 0.6x React Native. I've got a version of the library working on 0.59.x but when I run it on 0.6x I get the following json response (together with server 500):
Body:
{"originModulePath":"screens/custom-action-screen.js","targetModuleName":"NativeModules","message":"Unable to resolve module `NativeModules` from `screens/custom-action-screen.js`: NativeModules could not be found within the project.\n\nIf you are sure the module exists, try these steps:\n 1. Clear watchman watches: watchman watch-del-all\n 2. Delete node_modules: rm -rf node_modules and run yarn install\n 3. Reset Metro's cache: yarn start --reset-cache\n 4. Remove the cache: rm -rf /tmp/metro-*","errors":[{"description":"Unable to resolve module `NativeModules` from `screens/custom-action-screen.js`: NativeModules could not be found within the project.\n\nIf you are sure the module exists, try these steps:\n 1. Clear watchman watches: watchman watch-del-all\n 2. Delete node_modules: rm -rf node_modules and run yarn install\n 3. Reset Metro's cache: yarn start --reset-cache\n 4. Remove the cache: rm -rf /tmp/metro-*"}],"name":"Error","stack":"Error: Unable to resolve module `NativeModules` from `screens/custom-action-screen.js`: NativeModules could not be found within the project.\n\nIf you are sure the module exists, try these steps:\n 1. Clear watchman watches: watchman watch-del-all\n 2. Delete node_modules: rm -rf node_modules and run yarn install\n 3. Reset Metro's cache: yarn start --reset-cache\n 4. Remove the cache: rm -rf /tmp/metro-*\n at ModuleResolver.resolveDependency (/Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)\n at ResolutionRequest.resolveDependency (/Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)\n at DependencyGraph.resolveDependency (/Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)\n at Object.resolve (/Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/lib/transformHelpers.js:267:42)\n at /Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31\n at Array.map (<anonymous>)\n at resolveDependencies (/Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)\n at /Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33\n at Generator.next (<anonymous>)\n at asyncGeneratorStep (/Users/krzysztofkubicki/Workspace/PublicRelease/React-Native-Dev/SampleApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)"}
So my quetion is: How is it possible that the NativeModules were "visible" in previous version? All I did was upgrade the react native version and left all the code as it was.
It still works on 0.59.

bundling failed: Error: While resolving module `metro/src/lib/bundle-modules/HMRClient`

I have created a new project called metro. when I run it, this error appears on my cli nodejs:
error: bundling failed: Error: While resolving module metro/src/lib/bundle-modules/HMRClient, the Haste package metro was found. However the module src/lib/bundle-modules/HMRClient could not be found within the package. Indeed, none of these files exist:
D:\programming\react native\metro\src\lib\bundle-modules\HMRClient(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
D:\programming\react native\metro\src\lib\bundle-modules\HMRClient\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
at resolveHasteName (D:\programming\react native\metro\node_modules\metro-resolver\src\resolve.js:236:9)
at Object.resolve (D:\programming\react native\metro\node_modules\metro-resolver\src\resolve.js:103:20)
at ModuleResolver.resolveDependency (D:\programming\react native\metro\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:143:31)
at ResolutionRequest.resolveDependency (D:\programming\react native\metro\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (D:\programming\react native\metro\node_modules\metro\src\node-haste\DependencyGraph.js:283:16)
at Object.resolve (D:\programming\react native\metro\node_modules\metro\src\lib\transformHelpers.js:261:42)
at dependencies.map.result (D:\programming\react native\metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:399:31)
at Array.map (<anonymous>)
at resolveDependencies (D:\programming\react native\metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:18)
at D:\programming\react native\metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:269:33
my react-native version is 0.59.8
I was stuck in the same issue,
So what I did was:
Find the file at the path: node_modules/react-native/Libraries/Utilities/HMRClient.js
Change the line: const MetroHMRClient = require('metro/src/lib/bundle-modules/HMRClient');
To: const MetroHMRClient = require('../../../#react-native-community/cli/node_modules/metro/src/lib/bundle-modules/HMRClient');
Was the only thing that worked for me, the only issue is that if you reinstall de node_modules you will need to replace the line again. Because that I added this script to my package.json:
"postinstall": "sed -i '' \"s#metro#../../../#react-native-community/cli/node_modules/metro#g\" ./node_modules/react-native/Libraries/Utilities/HMRClient.js"
The above script takes care of the replacing after each new npm install
I had the same issue after updating react-native to v0.59.8.
What I ended up doing was adding a dev dependency to metro package with npm install --save-dev metro which is currently at v0.54.1.
This solved it for me!
Becouse I named this project metro the problem had occured. I create a new project with new name the problem is solved.