Comments (20)
got it resolved by using "react-native start --reset-cache", the reference changed from Desktop to node_modules.
from react-native-create-library.
Delete your node_module and run npm install
from react-native-create-library.
Similar error said my lib does not exist in the Haste module map. None of above resolve the issue.
from react-native-create-library.
fixed by npm add @babel/runtime
from react-native-create-library.
@evanjmg Do you mean react-native link
? Unfortunately you cannot symlink a react native package via npm link
. This is a problem with the metro bundler and you can follow the issue here: facebook/metro#1
from react-native-create-library.
I ran into this same issue.
I inspected the node_modules folder for the custom library, and it looks like the custom library was not copied there properly. Instead, it stores a reference to wherever the library is stored on your computer. For me, it was at a different directory. I think that the npm start server was not able to properly handle copying the referenced folder from the node_modules.
For a workaround, I deleted the reference, created a new directory in node_modules with the same name, then copied all files from where the library exists, to that newly created directory in node_modules. Then it worked.
from react-native-create-library.
I'm confused by React-Native's official documentation, specifically:
After [running react-native-create-library] you will navigate into MyLibrary folder and install the npm package to be locally available for your computer by doing:
$ npm install
After this is done you can go to your main react app folder (which you created by doing react-native init MyApp)
- add your newly created module as a dependency in your package.json
- run npm install to bring it along from your local npm repository.
It seems to imply that running npm install
in the newly created library directory that npm will know to look here when instructed to install the package. This did not work for me, and my attempt to install it by directly referencing the file brought me here, as the Haste map did not follow the sym-link.
Are our options really just:
-
push every change to a remote repo so that it can be downloaded
-
manually copy the files into the node_modules dir every time
Both of these feel like an unecessary extra step, especially considering what the React-Native docs seem to imply is possible.
from react-native-create-library.
I'm getting the same error. @Samykills, did you manage to solve it?
from react-native-create-library.
Maybe it has to be moved to the dependency list.
I had a similar error in the project
Module
dateformat does not exist in the Haste module map
and the fix was to explicitly add dateformat
as a dependency. Previously it wasn't and it worked fine.
from react-native-create-library.
@Samykills how do you link the library? You should reference the library within the package.json
in your main app and install it via npm install
. It seems currently it tries to use library from the Desktop and not from the node_modules
folder.
from react-native-create-library.
@maicki ^^^ that's the error I was talking about earlier.
from react-native-create-library.
@thorbenprimke Did you add dateformat
to the dependency list of the library or the app you use the lib?
from react-native-create-library.
from react-native-create-library.
Add this command to your terminal >_
npm add @babel/runtime
Problem solved!
from react-native-create-library.
What happened with me for this problem,
I encountered this problem twice,
-
first time i mistakenly imported a js package when it was not installed, it resolved by removing that mistaken import statement
-
second time i was trying to install 'react-native-modal-overlay' package, and instead of using npm install, i used yarn add react-native-modal-overlay, tried all steps i could find on net, but not resolved, finally, I took a fresh install of repository in another package, -----then also the build failed, t
-- then i ran npm cache clean, ( the result asked to run command 'npm install --cache /tmp/empty-cache'
-- i ran this command, and then tried to make build it succeeded
from react-native-create-library.
as of today, I still have to npm i the package remotely; npm link only works for the native code - once the build completes the javascript doesn't work - I get this error
from react-native-create-library.
what worked for me was to check at the top of your file so that it does not imported something like
import { threadId } from 'worker_threads';
Remove that and it works
from react-native-create-library.
I'm confused by React-Native's official documentation, specifically:
After [running react-native-create-library] you will navigate into MyLibrary folder and install the npm package to be locally available for your computer by doing:
$ npm install
After this is done you can go to your main react app folder (which you created by doing react-native init MyApp)
- add your newly created module as a dependency in your package.json
- run npm install to bring it along from your local npm repository.
It seems to imply that running
npm install
in the newly created library directory that npm will know to look here when instructed to install the package. This did not work for me, and my attempt to install it by directly referencing the file brought me here, as the Haste map did not follow the sym-link.Are our options really just:
- push every change to a remote repo so that it can be downloaded
- manually copy the files into the node_modules dir every time
Both of these feel like an unecessary extra step, especially considering what the React-Native docs seem to imply is possible.
Thank you, I think you are correct about the React-Native's doc, npm install
really has nothing to do with making npm package to be locally available.
from react-native-create-library.
If nothing work try to update dependencies
in package.json
as
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4"
...
}
from react-native-create-library.
Yep it looks like symlinks are the issue. Having the same problem with importing sibling modules within a Yarn Workspaces mono-repo. I think the solution for now will be to use watchman to manually copy over the sibling module to the consumer's node_modules folder on every change.
from react-native-create-library.
Related Issues (20)
- Any plans to create native modules with a view component? HOT 4
- when there is no library's name with this cli, exception handling is needed
- Is this project dead ? HOT 7
- iOS module not importable after install HOT 6
- How can I create a “react native” library in Windows that is developed locally?
- React Native Library for TV HOT 1
- .podspec file is created in ios folder HOT 1
- Library
- Does anyone now how to install react-navigation in the library project?
- Just Use create-react-native-library
- error: bundling failed: ambiguous resolution: module .../index.js tries to require react-native, but there are several files providing this module. You can delete or fix them HOT 2
- Any suggested guide to building a native module using this lib(Question)
- [Feature Request] Provide test template.
- Whats the process of creating a module with cocoapods dependency HOT 1
- Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
- examples_postinstall removes wrong files
- Cannot open the generated ios workspace HOT 6
- Trailing whitespace in generated library project
- --generate-example does not work with no yarn installed
- [minor] does not show correct directory name at the end
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-create-library.