Error importing NPM module to nativescript app - npm

Trying to import #nimiq/core or #nimiq/core-web or https://cdn.nimiq.com/nimiq.js to my Nativescript app but I can't found the way.
I've already tried with nativescript-nodeify but it thows and error in nativescript-vue (which I'm using)
Error is: Cannot find module '[...]\platforms\android\app\src\main\assets\app\tns_modules\nativescript-nodeify\patch-npm-packages.js'.

Related

'Unable to resolve module react-native' when install react-native library

I'm trying to create some audio and video playback. I've tried to install several library like react-native-video, react-native-video-player but it keeps throw error 'Unable to resolve module react-native-video-player from C:\Users\AHT\OneDrive\Desktop\ignite-youth\features\fuel\screens\SeriesPost.tsx: react-native-video-player could not be found within the project or in these directories: node_modules'. I just normally import the library like this:
import VideoPlayer from 'react-native-video-player';
Any one has solution? Thank you

Adding #bam.tech/react-native-batch to a fresh new react native project does not work

I try to yarn add #bam.tech/react-native-batch but I got the following error:
node_modules/#bam.tech/react-native-batch/android/src/main/java/tech/bam/RNBatchPush/RNUtils.java:113: error: no suitable method found for put(String, batchEventData.put(key, URI.create(valueMap.getString("value")));
and
node_modules/#bam.tech/react-native-batch/android/src/main/java/tech/bam/RNBatchPush/RNBatchModule.java:529: error: no suitable method found for setAttribute(String, editor.setAttribute(key, URI.create(url));
while doing yarn android (no error on iOS)
I am using react 18 and *react-native 0.69.1

How to resolve ESLint error unable to resolve path to module 'react-native'

New to react native and trying to setup ESLint in my project. I am getting this specific error:
Unable to resolve path to module 'react-native'. (import/no-unresolved)
I searched on SO and found similar threads, but nothing seems to work. I tried cleaning the npm cache as well.
import { AppRegistry } from 'react-native';
There is a red underline on my index.js file in the project root (using Atom editor) and under the word react in the above code snippet.
As per the react native guide
AppRegistry should be required early in the require sequence to make
sure the JS execution environment is setup before other modules are
required.
If you are struggling with es-lint configuration and guess that it's showing false error then you can add .eslinrc file at the root of the project and configure eslint rule as required. I suggest airbnb standard, this guide show full setup here

Angular flex-layout in Ionic3... rxjs/operator not found?

Trying to use #angular/flex-layout in an existing npm-enabled Ionic 3 project.
Adding "FlexLayoutModule" to my main module's imports won't allow the app to start, saying that: cannot find module "rxjs/operators" is the cause.
Already cleared node_module, npm install, reinstalled Ionic CLI. Nothing helps. Could it be a version conflict? Moreover, I'm already using Observables in this project. I don't get it. And the import of "FlexLayoutModule" is in cause of this issue (disabling the import removes the issue).
Anyone could be successful at using flex-layout with ionic? I've seen this plunk, but it uses system.js, so not 100% reproducing my goal.
http://plnkr.co/edit/y8R0MF?p=info
Edit: a more verbose issue:
Uncaught (in promise): Error: Cannot find module "rxjs/operators"
Error: Cannot find module "rxjs/operators" at Object.580
(http://localhost:8100/build/22.main.js:319:7) at webpack_require
(http://localhost:8100/build/main.js:48:30) at Object.1021
(http://localhost:8100/build/22.main.js:11:79) at webpack_require
(http://localhost:8100/build/main.js:48:30) at
http://localhost:8100/build/main.js:122015:10 at t.invoke
(http://localhost:8100/build/polyfills.js:3:9283) at Object.onInvoke
(http://localhost:8100/build/main.js:4650:37) at t.invoke
(http://localhost:8100/build/polyfills.js:3:9223) at r.run
(http://localhost:8100/build/polyfills.js:3:4452) at
http://localhost:8100/build/polyfills.js:3:14076
I'm getting a similar error with Angular CLI. Everything is OK until I include FlexLayoutModule in the app's NgModule imports. Then I get the error:
Module not found: Error: Can't resolve 'rxjs/operators' in 'D:\dev\Vms.Signup.Client\node_modules\#angular\flex-layout\esm5'
I updated to the latest rxjs and that seems to have fixed it.

React Native: Can't import local files/components

In my react native cli project I am having trouble importing local files.
I just created the project using cli and it was working fine. I ran it in my mobile and it showed the default welcome message. Then I made src folder, components folder in it and created a Header component.
As soon as I imported the header component in App.js and used it it showed this errror message in my packager console.
Bundling `index.js` [development, non-minified] 0.0% (0/317),failed.
error: bundling failed: UnableToResolveError: Unable to resolve module `./src/components/Header` from `/home/sagar/workspace/native/my_expences/App.js`: could not resolve `/home/sagar/workspace/native/my_expences/src/components/Header' as a file nor as a folder
at ModuleResolver._loadAsFileOrDirOrThrow (/home/sagar/workspace/native/my_expences/node_modules/metro-bundler/src/node-haste/DependencyGraph/ModuleResolution.js:337:11)
at ModuleResolver._resolveFileOrDir (/home/sagar/workspace/native/my_expences/node_modules/metro-bundler/src/node-haste/DependencyGraph/ModuleResolution.js:222:17)
at ModuleResolver.resolveNodeDependency (/home/sagar/workspace/native/my_expences/node_modules/metro-bundler/src/node-haste/DependencyGraph/ModuleResolution.js:236:19)
at ResolutionRequest.resolveDependency (/home/sagar/workspace/native/my_expences/node_modules/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js:111:14)
at dependencyNames.map.name (/home/sagar/workspace/native/my_expences/node_modules/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js:136:10)
at Array.map (<anonymous>)
at ResolutionRequest.resolveModuleDependencies (/home/sagar/workspace/native/my_expences/node_modules/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js:135:42)
at Promise.resolve.then (/home/sagar/workspace/native/my_expences/node_modules/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js:175:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
The error goes away if I remove the Header component and the import statement.
Please help
Edit:
It turns out it is having trouble importing file with jsx extension. I changed the extension to js and the error went away.
So, How can I import jsx files.