I am getting this errorr while taking android build react-native, screenshot provided below
TASK: react-native-doc-viewer compileDebugJavaWithJavac FAILED
package com.facebook.react.views.webview does not exist
https://i.stack.imgur.com/H17A8.png
The deprecated class com.facebook.react.views.webview is not actually being used. It is just a redundant import. Could be fixed by removing the import in node_modules/react-native-doc-viewer/android/src/main/java/com/reactlibrary/RNReactNativeDocViewerModule.java
Remove the ununsed import:
import com.facebook.react.views.webview.ReactWebViewManager;
Related
I use vite to build one react environment. When I import GLTFLoader from the module, and vite commandline mentioned that:
Vite Error, /node_modules/.vite/deps/three_examples_jsm_loaders_GLTFLoader.js?v=9d4ee121 optimized info should be defined
Here's my code:
import * as Three from "three"
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
[...]
const gltfLoader = new GLTFLoader()
gltfLoader.setPath('public/')
gltfLoader.load('000.hdr', gltf => {
gltf.scene.scale.set(0.2,0.2,0.2)
scenes.add(gltf.scene)
})
Here's the error message:
For others in the future, YMMV: deleting node_modules and pnpm-lock.yaml solved the issue.
Already solve this question.
When the commandline mentioned vite error, just need to close dev-server, then reload. Vite would clean the cache tmp files in .vite.
this is usually caused by lockfiles or node_modules/.cache/vite (or maybe in your case node_modules/.vite)
I'm trying to use AssemblyScript to build a WebAssembly inference engine for a TensorFlow.js model that I have.
I started with essentially the quickstart AssemblyScript app (which works great) and then simply added #tensorflow/tfjs to my dependencies:
$ npm install --save #tensorflow/tfjs
and added an import to assembly/index.ts:
import * as tf from "#tensorflow/tfjs";
Full code here on Github
This results in an error when I build it:
$ npm run asbuild
> test-assemblyscript#1.0.0 asbuild
> npm run asbuild:untouched && npm run asbuild:optimized
> test-assemblyscript#1.0.0 asbuild:untouched
> asc assembly/index.ts --target debug
ERROR TS6054: File '~lib/#tensorflow/tfjs.ts' not found.
import * as tf from "#tensorflow/tfjs";
~~~~~~~~~~~~~~~~~~
in assembly/index.ts(1,21)
FAILURE 1 parse error(s)
Am I misunderstanding the import syntax? I am puzzled why it would be looking in ~lib for this versus node_modules.
If you are sure the module you are trying to import is assemblyscript files, you can import with something like this ./node_modules/#tenderflow/tfjs.
I am not sure if #tensorflow has assembly files built, but I did that on assemblyscript-json for assemblyscript#0.19.8 (0.25.2 doesn't have that problem).
For example
assemblyscript-json has exported assemblyscript files from its package, so I can do this (ref)
import { JSON } from './node_modules/assemblyscript-json/assembly';
export function formatJsonString(jsonString: string): string {
const jsonObj: JSON.Obj = <JSON.Obj>JSON.parse(jsonString);
return jsonObj.stringify();
}
I'm migrating react-intl to version 3.0, and need to polyfill locale-data for IE. Specifically I want to load a polyfill of locale data for en-US. I can only find #formatjs/intl-relativetimeformat/dist/locale-data/en locale file.
if (!Intl.RelativeTimeFormat) {
// eslint-disable-next-line global-require
require('#formatjs/intl-relativetimeformat/polyfill');
// eslint-disable-next-line global-require
require('#formatjs/intl-relativetimeformat/dist/locale-data/en-US');
}
It leads to this error :
Module not found: Error: Can't resolve '#formatjs/intl-relativetimeformat/dist/locale-data/en-US' in '/xxx/xxx/xxx/xxx/app'
Try the below format in "#formatjs/intl-relativetimeformat": "^7.2.0",
import '#formatjs/intl-pluralrules/polyfill'
import '#formatjs/intl-pluralrules/locale-data/en'
import '#formatjs/intl-pluralrules/locale-data/de'
import '#formatjs/intl-relativetimeformat/polyfill'
import '#formatjs/intl-relativetimeformat/locale-data/en'
import '#formatjs/intl-relativetimeformat/locale-data/de'
and addLocaleData is no removed already as per https://formatjs.io/docs/react-intl/upgrade-guide-3x/#migrate-to-using-native-intl-apis
try to install :
npm i #formatjs/intl-relativetimeformat
I had this same exact issue, when I checked the #formatjs directory inside node_modules/ there was no dist directory #formatjs/intl-relativetimeformat/**dist/**locale-data/en so I removed it from the import and everything worked fine.
.flowconfig
...
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow/
...
index.js
import { View } from 'react-native'; ---> produce: react-native. Required module not found.
...
Maybe my libs settings for flowconfig is broken?
react-native 0.42.3
flow-bin 0.45.0
Here's a quick solution that works for me to ignore the flow related errors for react-native
Change into your project directory
cd my-awesome-project
Create a directory called flow-typed in your project if it doesn't exists
mkdir flow-typed
Add a file react-native.js
touch react-native.js
Add the following to react-native.js and hit save using your favorite editor
declare module 'react-native' {
declare module.exports: any;
}
check this out . write the package names you need and add the first regex on the libs. its a hack ;)
I installed a module via npm, and am trying to access it inside my typescript file.
npm install marker-animate-unobtrusive --save
import SlidingMarker = require('marker-animate-unobtrusive');
This results in
//Error TS2307: Cannot find module 'marker-animate-unobtrusive'
Search for this issue brings upchanging the compiler options, others mention creating a d.ts file for Type Script to recognize the module, but I never got a clear answer anywhere. I tried these methods, but with little success so far.
I am using Angular 2 and Ionic 2 for this, if that information helps.
Any help is appreciated!!
The problem is because the SlidingMarker npm module doesn't yet have a type definition.
1) Create generic definition in typings/marker-animate-unobtrusive.d.ts:
declare module 'marker-animate-unobtrusive' {
const x: any;
export = x;
}
2) Add this file to list of definitions in typings/main.d.ts (or typings/index.d.ts if you are using the newer typings):
/// <reference path="marker-animate-unobtrusive.d.ts"></reference>
3) Next, update your import statement:
import * as SlidingMarker from 'marker-animate-unobtrusive';
Volia! Note, you may need to change any variables cast as "SlidingMarker" to "any" to avoid other TypeScript errors.